0
我正在關注本教程: https://css-tricks.com/why-npm-scripts/ 確實發現它很有用。但我在腳本中添加了瀏覽器同步功能,它從不會調用我的index.html文件,該文件位於src和dist文件夾內。從我的根目錄我有以下package.json腳本部分:瀏覽器同步無法獲取錯誤
"scripts": {
"scss": "node-sass --output-style compressed -o dist/css src",
"autoprefixer": "postcss -u autoprefixer -r dist/css/*",
"lint": "eslint src/js",
"uglify": "mkdir -p dist/js && uglifyjs src/js/*.js -m -o dist/js/app.js && uglifyjs src/js/*.js -m -c -o dist/js/app.min.js",
"imagemin": "imagemin src/images dist/images -p",
"serve": "browser-sync start --files 'dist/styles/*.css, dist/js/*.js'",
"build:css": "npm run scss && npm run autoprefixer",
"build:js": "npm run lint && npm run uglify",
"build:all": "npm run build:css && npm run build:js && npm run build:imagemin",
"watch:css": "onchange 'src/*.scss' -- npm run build:css",
"watch:js": "onchange 'src/js/*.js' -- npm run build:js",
"watch:all": "parallelshell 'npm run serve' 'npm run watch:css' 'npm run watch:js'"
},
有人可以向我解釋它是如何知道運行索引文件?我知道它從根文件夾構建了一個服務器,但我的package.json不在dist文件夾內?