Home » Javascript » node sass watch doesnt work when called from subscript

node sass watch doesnt work when called from subscript

Posted by: admin November 1, 2017 Leave a comment

Questions:

Sorry if the title isn’t very explicit.

So I have those scripts in my package.json in a React App build from create-react-app.

"build-css": "node-sass-chokidar --include-path ./node_modules src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./node_modules src/ -o src/ --watch --recursive",

This works well as changes in scss files are correctly watched after a yarn watch-css

But when I want to simplify the watch-css script like that :

"build-css": "node-sass-chokidar --include-path ./node_modules src/ -o src/",
"watch-css": "npm run build-css && npm run build-css --watch --recursive",

But the watch functionality this doesn’t work anymore.

So, is there any way to avoid to duplicate the build-css script ??

Thanks.

Answers: