即使带有监视标志,Node-sass也不会读取scss文件中的更改

时间:2018-10-10 06:52:11

标签: html css npm sass node-sass

这个问题不是特别针对代码,但它是在我编码时发生的。

"scripts": {
"watch:sass": "node-sass sass/main.scss css/style.css -w",
"devserver": "live-server --browser=firefox",
"start": "npm-run-all --parallel devserver watch:sass ",
"compile:sass": "node-sass sass/main.scss css/style.comp.css",
"concat:css": "concat -o  css/style.concat.css css/icon-font.css css/style.comp.css",
"prefix:css": "postcss --use autoprefixer -b \"last 10 versions\" css/style.concat.css -o css/style.prefix.css",
"compress:css": "node-sass css/style.prefix.css css/style.css --output-style compressed",
"build:css": "npm-run-all compile:sass concat:css prefix:css compress:css"

}

上面是我在package.json文件中使用的脚本。问题是,当我大多数时候在终端中的任何scss或H​​TML文件中编写代码时,它只说已检测到更改,而没有将sass代码写入CSS,因此浏览器中不会自动呈现任何更改。

Change detected C:\Users\Heaven\Desktop\coolportfolio\sass\main.scss

我必须手动保存main.scss文件,然后说

=> changed: C:\Users\Heaven\Desktop\coolportfolio\sass\main.scss
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\Heaven\Desktop\coolportfolio\css\style.css
CSS change detected C:\Users\Heaven\Desktop\coolportfolio\css\style.css

我对导致此问题的原因感到困惑,手动保存main.scss文件也浪费了我的时间。我对编码有点陌生,所以请记住这一点。

0 个答案:

没有答案