I have a static site that compile Sass using node-sass
.
Currently I'm using Grunt to watch the file, but I feel it's overkill because I can use their built-in CLI.
So I add this in my package.json:
// package.json
...
"scripts": {
"sass": "node-sass -w input/dir -o output-dir/"
}
The problem is, I need to require
a Sass framework module (installed globally) in the --include-path
. I can do this in Gruntfile:
// Gruntfile.js
sass: {
options: {
includePaths: require("the-framework").includePaths()
},
...
},
So the first thing that come to my mind is to interpolate the string like:
// package.json
...
"scripts": {
"sass": "node-sass -w input/dir -o output-dir/ --include-path " + require("the-framework").includePaths()
}
And as expected, it doesn't work. Well the script runs, but the interpolated variable is ignored.
Any solution or alternative? If possible, I would prefer not to create additional file just to store the variable.
Thanks