Home >Development Tools >VSCode >What to do if vscode sass compilation error occurs

What to do if vscode sass compilation error occurs

藏色散人
藏色散人Original
2020-04-02 10:21:313940browse

What to do if vscode sass compilation error occurs

What should I do if I get an error when compiling vscode sass?

Use vscode to compile sass

If you want to compile through the command line, you can follow https://www.sass.hk/ Go here and follow the steps Installation, but there was a problem when installing the Taobao image and the installation was unsuccessful, so I used vscode to compile sass

Recommended learning: vscode tutorial

First Step 1, install easy sass in vscode. The picture below shows the successful installation status

What to do if vscode sass compilation error occurs

Step 2, modify the configuration of vscode

What to do if vscode sass compilation error occurs

"easysass.compileAfterSave": true, 
 "easysass.formats": [ //nested:嵌套缩进的 css 代码。
//expanded:没有缩进的、扩展的css代码。
//compact:简洁格式的 css 代码。
//compressed:压缩后的 css 代码
        {
            "format": "expanded",
            "extension": ".css"
        },
        {
            "format": "compressed",
            "extension": ".min.css"
        }
    ],
    "easysass.targetDir": "css/" //路径

The third step is to create a new folder and create two new folders in the folder, one for sass and one for css. If you do not create a css folder, a folder will be automatically created after compilation

What to do if vscode sass compilation error occurs

The fourth step, then create demo.sass under sass, and then write

.box
    color: red
    .img
        width: 100%;
        display: block;

The fifth step, press ctrl s, it will be compiled directly, because you In the previous setting, easysass.compileAfterSave was set to true, so it will be compiled once after saving. This is also to improve development efficiency

Finally, you will find that there is an additional css file and a min.css file under the css. This has something to do with the settings you have set, one without indentation and one with compression

What to do if vscode sass compilation error occurs

That’s it...

The above is the detailed content of What to do if vscode sass compilation error occurs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn