Skip to content

Instantly share code, notes, and snippets.

@madmas
Created July 25, 2016 16:43
Show Gist options
  • Save madmas/39a29ced6bdd717a335d42ba1648f3aa to your computer and use it in GitHub Desktop.
Save madmas/39a29ced6bdd717a335d42ba1648f3aa to your computer and use it in GitHub Desktop.
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:0.13'
classpath 'com.moowork.gradle:gradle-gulp-plugin:0.13'
}
}
subprojects{
apply plugin: 'com.moowork.node'
apply plugin: 'com.moowork.gulp'
node {
// Version of node to use.
version = '4.4.7'
// Base URL for fetching node distributions.
distBaseUrl = 'http://nodejs.org/dist'
// If true, it will download node using above parameters.
// If false, it will try to use globally installed node.
download = true
workDir = file("${rootProject.buildDir}/nodejs")
nodeModulesDir = file("${rootProject.projectDir}/gradle")
}
npm_install {
inputs.files file("${rootProject.projectDir}/package.json")
outputs.files file("${rootProject.projectDir}/gradle/node_modules")
args = ['--loglevel', 'warn']
description = "Install Node.js packages"
outputs.upToDateWhen { false }
}
gulp{
colors = true
}
// makes sure on each build that gulp is installed
gulp_prod.dependsOn 'installGulp'
// processes your package.json before running gulp build
gulp_prod.dependsOn 'npmInstall'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment