This plugin allows to use Node.js script and tools via gradle. NodeJs will be downloaded automatically and reused across execution.
plugins { id "de.solugo.gradle.nodejs" version "..." } nodejs { version = '10.8.0' rootPath = 'subpath' }
Run node script
gradle node<ScriptName> -Pargs="..." // node <script-name>.js <args>
Run npm script
gradle npm<TaskName> -Pargs="..." // npm <task-name> <args>
Run yarn task
gradle yarn<TaskName> -Pargs="..." // yarn <task-name> <args>
Run node module
gradle npx<ModuleName> -Pargs="..." // npx <module-name>.js <args>
This task type enables you to create custom tasks using Node.js or common Node.js modules.
task("webpack", type: NodeJsTask) { require = ["webpack", "webpack-cli"] executable = "webpack-cli" args = ["--mode=production"] }
gradle npmInstall -Pargs="--save-dev webpack"
This plugin allows to use Webpack bundler via gradle. Webpack is automatically added to the processResources task.
plugins { id "de.solugo.gradle.webpack" version "..." }
Run node script
gradle webpack -Pargs="..." // webpack --mode=production <args>
Run node script
gradle webpackWatch -Pargs="..." // webpack --mode=development --watch <args>