I'm trying to setup SCSS-lint onto a Angular 2 project and although I can get it to work on npm start and if I ran my command manually, I can not figure out how to get it to run for when I save a file.
"scripts": {
"ng": "ng",
"start": "npm run scss-lint && ng serve --host $npm_package_config_host --port $npm_package_config_port --ec=true",
"start-live-data": "ng serve --host $npm_package_config_host --port $npm_package_config_port --environment=livedata --ec=true --aot",
"start-prod": "npm run build-prod && npm run pm2:restart-prod || npm run pm2:start-prod",
"start-prod-v2": "npm run build-prod && npm run pm2:restart-prod-v2 || npm run pm2:start-prod-v2",
"build": "ng build --aot",
"prebuild-prod": "npm install",
"build-prod": "ng build --environment=production --aot",
"test": "ng test -sm=false --code-coverage --single-run",
"test-watch": "ng test --code-coverage",
"test-debug": "ng test --browsers ChromeDebug",
"lint": "ng lint",
"scss-lint": "sass-lint 'src/**/*.scss' -v -q",
"e2e": "ng e2e",
"pm2:restart-prod": "NODE_ENV=production pm2 restart audience-dashboard-client",
"pm2:start-prod": "NODE_ENV=production pm2 start -i max --name audience-dashboard-client node -- server.js",
"pm2:restart-prod-v2": "NODE_ENV=production PORT=8085 pm2 restart audience-client-2",
"pm2:start-prod-v2": "NODE_ENV=production PORT=8085 pm2 start --name audience-client-2 node -- server.js"
}
npm run scss-lint The above command is the one that I'd like to run when the SCSS files are saved.
Has anyone experienced this problem before?
****** Update ******
The watch appears to be happening through ng serve and is it possible to add to this command?
You can try this. First install "watch" package:
npm install watch
Then in your package.json add in your scripts:
"scss:compiler": "./node_modules/.bin/watch \"sass-lint 'src/**/*.scss' -v -q\" src"
src should be the name of the folder you want to watch for changes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.