私は次のようなディレクトリ構造を持っている:npmスクリプトで 'watch'を使うにはどうすればいいですか?
そして、私のpackage.json
は、次のようになります
{
"name": "personal_site",
"version": "1.0.0",
"description": "My personal website.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"node-sass": "node-sass --output-style compressed --include-path node_modules/bourbon/app/assets/stylesheets/ --include-path node_modules/bourbon-neat/app/assets/stylesheets/ 'src/scss/styles.scss' 'dist/css/bundle.min.css'",
"html-minifier": "html-minifier --collapse-whitespace --remove-comments --remove-attribute-quotes -o 'dist/index.html' 'src/index.html'",
"imagemin": "imagemin src/images dist/images",
"serve": "http-server ./dist"
},
"author": "Dean Gibson",
"license": "ISC",
"dependencies": {
"bourbon": "^4.2.6",
"bourbon-neat": "^1.7.4",
"normalize-scss": "^4.0.3"
},
"devDependencies": {
"html-minifier": "^1.3.0",
"http-server": "^0.9.0",
"node-sass": "^3.4.2"
}
}
だから、まず、私は、例えば、個別にこれらのスクリプトのそれぞれを実行する必要がnpm run node-sass
またはnpm run html-minifier
など私は、理想的には、次の操作を行いますどのnpm serve
を実行することであるたいと思う何を:
- 実行HTML-minifier
- 実行ノード-SASS
- ラン、ラン画像分
- 実行httpサーバ
- 最後に、私の
src
フォルダ内のすべてを見て、 ファイルを変更してそれぞれのスクリプトを実行します。node-sass
など。
この問題にはどのようにして対処できますか?
gulpをそのタスクに使用すると考えましたか? – rmjoia