微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

onchange问​​题,它无法识别scss文件更改

如何解决onchange问​​题,它无法识别scss文件更改

我在项目中安装了onchange插件,但是当我在npm上执行“ watch:scss”时,无法运行脚本,它只是无法检测到文件上的任何更改,也许是语法错误,但我检查了很多次,希望有人能帮忙:)

    {
  "name": "guia-hoteles","version": "1.0.0","description": "Primer proyecto de Node.js","main": "index.html","scripts": {
    "test": "echo \"Error: no test specified\" && exit 1","dev": "lite-server","scss": "node-sass -o css/ css/","watch:scss": "onchange 'css/*.scss' -- npm run scss ","start": "concurrently \"npm run watch:scss\" \"npm run dev\""
  },"repository": {
    "type": "git","url": "git+https://juani_olguin@bitbucket.org/juani_olguin/guia-hoteles.git"
  },"author": "Juan Ignacio Olguin","license": "ISC","homepage": "https://bitbucket.org/juani_olguin/guia-hoteles#readme","devDependencies": {
    "lite-server": "^2.5.4","node-sass": "^4.14.1","onchange": "^7.0.2","rimraf": "^3.0.2"
  },"dependencies": {
    "@popperjs/core": "^2.5.3","bootstrap": "^4.5.2","concurrently": "^5.3.0","jquery": "^3.5.1","open-iconic": "^1.1.1","popper.js": "^1.16.1"
  }
}

this is what git looks like when I run the script

解决方法

如果您使用的是Windows,则基本上只需更改双引号的单引号并转义双引号即可,例如:

"watch:scss": "onchange \\"css/*.scss\\" -- npm run scss ",

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。