为什么--output选项在node-sass中被忽略?

问题描述 投票:0回答:1

我尝试使用具有以下目录配置的npm脚本来编译SASS。

project
├ page1
│ └ style
│   ├ sass
│   │ └ *.scss
│   └ css
├ page2
│ └ style
│   ├ sass
│   │ └ *.scss
│   └ css
├ ...
├ pageN
│ └ style
│   ├ sass
│   │ └ *.scss
│   └ css
└ package.json

所以我考虑使用glob和node-sass的--output选项。

{
  "name": "sass",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "sass": "node-sass ./**/style/sass/ --output ./**/style/css/"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "node-sass": "^4.14.0"
  }
}

但是这并没有在CSS目录中生成CSS文件。

相反,SASS目录中有一个CSS文件。这意味着将忽略用于指定输出目录的--output选项。

如何使用npm脚本将它们编译到css目录中?

$ npm run sass

> [email protected] sass C:\Users\sanriot\Desktop\project
> node-sass ./**/assets/sass/ --output ./**/assets/css/

Rendering Complete, saving .css file...
Wrote CSS to C:\Users\sanriot\Desktop\project\page1\style\sass\style.css
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\sanriot\Desktop\project\page2\style\sass\style.css
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\sanriot\Desktop\project\page3\style\sass\style.css
Wrote 3 CSS files to C:\Users\sanriot\Desktop\project\**\style\css\
javascript node.js sass npm-scripts node-sass
1个回答
0
投票
选项需要在输入https://github.com/sass/node-sass#usage-1 node-sass [options] <input> [output]之前进行。
© www.soinside.com 2019 - 2024. All rights reserved.