| import org.gradle.api.tasks.Exec | |
| defaultTasks 'bower' | |
| // Get the path for the locally installed binaries | |
| task npmBin << { | |
| new ByteArrayOutputStream().withStream { os -> | |
| def result = exec { | |
| executable = 'npm' | |
| args = ['bin'] | |
| standardOutput = os | |
| } | |
| ext.binPath = os.toString().trim() + "/" | |
| } | |
| } | |
| // Install packages from package.json | |
| task npm(type: Exec) { | |
| description = "Grab NodeJS dependencies (from package.json)" | |
| commandLine = ["npm", "install"] | |
| inputs.file "package.json" | |
| outputs.dir "node_modules" | |
| tasks.npmBin.execute() | |
| } | |
| // Install the bower components for front-end library management | |
| task bower(dependsOn: 'npm', type: Exec){ | |
| commandLine "${npmBin.binPath}bower", 'install' | |
| } |
Friday, January 29, 2016
GRADLE & NODE NPM - gradle task for execute npm install and bower install
https://gist.github.com/spikeheap/8558786
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment