使用するコマンド
README.md
yarn init -y
yarn add -D
npm i -D
「_**ejs」もコンパイルされてしまうのを防ぐため修正しました。
package.json
{
"name": "npm-scripts_menta",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"autoprefixer": "^9.8.4",
"browser-sync": "^2.26.7",
"chokidar-cli": "^2.1.0",
"ejs-cli": "^2.2.0",
"node-sass": "^4.14.1",
"node-sass-globbing": "^0.0.23",
"npm-run-all": "^4.1.5",
"postcss-cli": "^7.1.1",
"watch": "^1.0.2"
},
"scripts": {
"start": "run-p watch:ejs2html watch:scss2cssprefix start:server",
"compile:ejs2html": "ejs-cli -b src/ejs/ \"/**/!(_)*.ejs\" -o dist/",
"watch:ejs2html": "chokidar \"src/ejs/\" -c \"npm run compile:ejs2html\" --initial",
"start:server": "browser-sync start -s dist -w src/*.html src/css/*.css src/js/*.js",
"compile:css2cssprefix": "postcss dist/css/style.css -u autoprefixer -o dist/css/style.css",
"compile:scss2css": "node-sass src/scss/style.scss --importer node_modules/node-sass-globbing/index.js dist/css/style.css --output-style expanded --source-map dist/css/",
"compile:scss2cssprefix": "run-s compile:scss2css compile:css2cssprefix",
"watch:scss2cssprefix": "chokidar \"src/scss/\" --command \"npm run compile:scss2cssprefix\" --initial"
}
}