[英]Separating SCSS and CSS files
This is my website folder structure:这是我的网站文件夹结构:
/images
/fonts
/js
/styles /
scss/
|
|– utilities/
| |– variables.scss
|
|– base/
| |– reset.scss
| |– typo.scss
|
|– pages/
| |– index.scss
| |– page1.scss
|
– main.scss
css/
// Save CSS Here
index.html
I have a root
folder, contains index.html
and few folders, like fonts
, js
, styles
... In the styles
folder, there's two folder, scss
and css
.我有一个
root
文件夹,包含index.html
和几个文件夹,如fonts
、 js
、 styles
......在styles
文件夹中,有两个文件夹, scss
和css
。 and in the scss
folder, there's main.scss
(which contains all the scss
-imported-), and few folders with scss
files, like: base
, utilities
, pages
...而在
scss
文件夹中,有main.scss
(其中包含所有scss
-imported-),并与几个文件夹scss
文件,如: base
, utilities
, pages
...
When I create a scss
files the compiler
creates the css
and css.map
in the same folder of the scss
file that been created.当我创建一个
scss
文件的compiler
创建css
和css.map
在同一文件夹scss
是被创建的文件。 For example, after creating variables.scss
it'll look like this:例如,在创建
variables.scss
它看起来像这样:
|– utilities/
| |– variables.css
| |– variables.css.map
| |– variables.scss
How can I separate the two types of files in different folders to look exactly like the example below?如何将不同文件夹中的两种类型的文件分开,使其看起来与下面的示例完全相同?
/images
/fonts
/js
/styles /
scss/
|
|– utilities/
| |– variables.scss
|
|– base/
| |– reset.scss
| |– typo.scss
|
|– pages/
| |– index.scss
| |– page1.scss
|
– main.scss
css/
|
|– utilities/
| |– variables.css
|
|– base/
| |– reset.css
| |– typo.scss
|
|– pages/
| |– index.css
| |– page1.css
|
– main.css
index.html
i suggest using live sass compiler for transpiling scss files for trying this : go to我建议使用实时 sass 编译器来转译 scss 文件以尝试此操作:转到
menu- file>preferences>settings>extension>live sass copile config>edit in settings.json
菜单-文件>首选项>设置>扩展>实时sass copile配置>在settings.json中编辑
and paste this: (your save path can be customized)并粘贴:(您的保存路径可以自定义)
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "./css/"
}
] ]
You need to rename the files you don't want to generate a CSS to have a underscore "_"
before the name.您需要将不想生成 CSS 的文件重命名为名称前带有下划线
"_"
。 And don't worry you don't need to change the name in the imports, SASS do that to you.不要担心您不需要更改导入中的名称,SASS 会为您做这些。
So your variables file would be _variables.scss
所以你的变量文件将是
_variables.scss
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.