1node -v
1cd Desktop
1cd ../ # 1つ上の階層に2cd ../../ # 2つ上の階層に3cd / # ドライブのルートに移動
1cd ~ # ホームに移動
1cd /d D:¥Users¥Public¥Pictures #DドライブのPicturesフォルダに移動
1pwd
1cd
1npm init -y
1{2 "name": "02_sample",3 "version": "1.0.0",4 "description": "",5 "main": "index.js",6 "scripts": {7 "test": "echo \"Error: no test specified\" && exit 1"8 },9 "keywords": [],10 "author": "",11 "license": "ISC"12}
1mkdir sass
1touch sass/sample.scss
1type nul > sass/sample.scss
1npm install --save-dev sass
1 "devDependencies": {2 "sass": "^1.79.3"3 }
1npx sass
1#main {2 width: 600px;3 p {4 margin: 0 0 1em;5 em {6 color: #f00;7 }8 }9 small {10 font-size: small;11 }12}
1 "scripts": {2 "test": "echo \"Error: no test specified\" && exit 1"3 },
1 "scripts": {2 "sass": "sass ./sass:./css",3 },
1npm run sass
1#main {2 width: 600px;3}4#main p {5 margin: 0 0 1em;6}7#main p em {8 color: #f00;9}10#main small {11 font-size: small;12}13 14/*# sourceMappingURL=sample.css.map */
1 "scripts": {2 "sass": "sass ./sass:./css --no-source-map",3 },
1 "scripts": {2 "sass": "sass input.scss:output.css",3 },
1 "scripts": {2 "sass": "sass ./sass:./css --style=スタイル名",3 },
1 "scripts": {2 "sass": "sass ./sass:./css --style=expanded",3 },
1#main {2 width: 600px;3}4#main p {5 margin: 0 0 1em;6}7#main p em {8 color: #f00;9}10#main small {11 font-size: small;12}
1 "scripts": {2 "sass": "sass ./sass:./css --style=compressed",3 },
1#main{width:600px}#main p{margin:0 0 1em}#main p em{color:red}#main small{font-size:small}/*# sourceMappingURL=sample.css.map */
1 "scripts": {2 "sass": "sass ./sass:./css",3 "min:sass": "sass ./sass:./css --style=compressed --no-source-map"4 },
1npm run min:sass
1 "scripts": {2 "sass": "sass ./sass:./css",3 "watch:sass": "sass ./sass:./css --watch"4 },
1npm run watch:sass
サンプルコード一覧へ