[英]How to make SASS compile upon change (watch) without npm start each time
Working on a new React project that is using SASS.致力于使用 SASS 的新 React 项目。 All of the.scss files are in the src/components directory, and strangely the start script is setup like this:所有的 .scss 文件都在 src/components 目录中,奇怪的是启动脚本是这样设置的:
"start": "npm-run-all -p watch:sass start:app"
but on the project when making a change in SCSS, we are having to ctrl-c out of the app and restart by doing npm start
again.但是在项目中,当在 SCSS 中进行更改时,我们必须 ctrl-c 退出应用程序并通过再次执行npm start
重新启动。 Is there some misconfiguration here?这里有一些错误配置吗? Seems like this should be watching the scss files and recompiling on the fly.看起来这应该是观察 scss 文件并即时重新编译。
Thanks for suggestions感谢您的建议
I'm not a front-end developer, but maybe you can use nodemon.我不是前端开发人员,但也许你可以使用 nodemon。 Install it using npm i nodemon.使用 npm i nodemon 安装它。 This tool will automatically restart your server if any changes happen.如果发生任何更改,此工具将自动重新启动您的服务器。 Take a look here Watch & Compile your Sass with npm看这里Watch & Compile your Sass with npm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.