Starting on a Grails 3 app and trying to use a node plugin. My custom javascript is located under grails-app/assets/javascripts
but when I run gradle build
it installs the node_modules
folder under my root project directory. This folder has all my JS libraries and I'm unable to access them from my within grails-app/assets/javascripts
.
Is there a way to install node_modules
under grails-app
? Do I need to specify the directory in my build.gradle
?
Here's my node and grunt plugins in my build.gradle
.
classpath "com.moowork.gradle:gradle-node-plugin:0.12" classpath "com.moowork.gradle:gradle-grunt-plugin:0.12"
apply plugin:"com.moowork.node" apply plugin:"com.moowork.grunt"
You can change the location of the node_modules folder.
First, upgrade the node and grunt plugins to version 0.13
classpath "com.moowork.gradle:gradle-node-plugin:0.13"
classpath "com.moowork.gradle:gradle-grunt-plugin:0.13"
Second, add the following to your build.gradle file:
node { nodeModulesDir = file("grails-app") }
This will create the node_modules folder under grails-app (ie grails-app/node_modules)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.