简体   繁体   English

如何在每次没有 npm start 的情况下使 SASS 在更改时编译(观看)

[英]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.

相关问题 如何在npm start中使用编译ES6(反应)组件和基础sass - How to use compile ES6 (react) components and foundation sass with npm start 如何在 gulp 4 中同时观看 sass 和 javascript - How to watch sass and javascript at the same time in gulp 4 用 npm 编译内联 sass? - Compile inline sass with npm? 当我输入 npm start 时如何启动 Gulp watch 任务 - How to start Gulp watch task when I type npm start 监视任务不编译sass文件 - Watch task doesn't compile sass files 如何使用以下Grunt配置编译Sass文件? - How to make compile Sass files with the following Grunt configuration? 有没有办法通过单击 VSCode 上的按钮/快捷方式同时运行“tsc -watch”和“npm start”? - Is there a way to run “tsc -watch” and “npm start” at the same time, with a click of a button/ shortcut on VSCode? 如何每次不触发命令就检查CSS更改 - How to check the css change without firing command each time 运行 npm run compile:sass 返回错误:npm ERR: missing script: compile:sass - Running npm run compile:sass returns error: npm ERR! missing script: compile:sass 如何在没有整页刷新的情况下让Grunt / Watch / LiveReload重新加载Sass / CSS? - How can I get Grunt/Watch/LiveReload to reload Sass/CSS without a full page refresh?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM