1. Using save will automatically add it to package.json.
1 2 |
|
Note:
Usually, when using npm to install, the following error will appear and the installation will fail. (network problem)
You can install node-sass through Taobao's npm image to solve the above problems.
$ npm install -g cnpm --registry=https://registry.npm.taobao.org (Install Taobao image)
$ cnpm install node-sass --save (use Taobao image to install node-sass)
Note: If node-sass still cannot be installed after installing the Taobao image, execute the following command
1 2 3 4 5 6 7 8 9 |
|
2. Enter webpack.base.config.js to configure scss module -- loaders (vue1.0)
$ npm install --save-dev sass-loader style-loader css-loader
1 2 3 4 5 6 7 8 9 |
|
Open webpack.base.config.js and add module -- rules (vue2.0) in loaders
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
3. If you need to use scss in the style tag of the vue file, you need to declare:
vue1.0
1 |
|
view2.0
1 |
|