I have the following setup in my custom Express application.
- I installed node-sass as dependency and is visible from my package.json file like so :
"dependencies": {
"express": "^4.17.1",
"node-sass": "^5.0.0",
"nodemon": "^2.0.7",
"npm-run-all": "^4.1.5",
"twig": "^1.15.4"
}
- I am running
npm run watch
to get things going. It's working great:
"scripts": {
"watch-sass": "node-sass -w src/scss/ -o pub/css/",
"watch-code": "nodemon --ext js,twig server.js",
"watch": "npm-run-all --parallel watch-code watch-sass"
},
After reading some of the Options we can use for node-sass from the official source, I thought I could simply place these options within my my server.js file like so, reload the server, and see the adjustments applied to my output file (i.e. pub/css/css_bundle.css).
const result = sass.renderSync({
outputStyle: 'compressed', //compressed | nested | expanded | compact
sourceMap: true, // or an absolute or relative (to outFile) path
});
...But no matter what happens, (i.e. running my "npm run watch" command), my output file does not compress.
I'm new to this process of managing sass configuration options. What am I missing or not doing correctly in order to manage and connect my node-sass options to my setup (i.e. everything inside of pub/css/)?