CSS sass --watch 自动缩小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8980398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:44:44  来源:igfitidea点击:

sass --watch with automatic minify?

csssassminify

提问by tester

Is there a way to run:

有没有办法运行:

sass --watch a.scss:a.css

sass --watch a.scss:a.css

but have a.cssend up being minified?

a.css最终被缩小了?

How would I avoid having to run a separate minification step as I compile my stylesheet?

我如何避免在编译样式表时运行单独的缩小步骤?

回答by Madan Sapkota

If you are using JetBrainseditors like IntelliJ IDEA, PhpStorm, WebStormetc. Use the following settings in Settings > File Watchers. enter image description here

如果您使用IntelliJ IDEAPhpStormWebStormJetBrains编辑器,请在设置 > 文件观察器中使用以下设置。 在此处输入图片说明

  1. Convert style.scssto style.cssset the arguments

    --no-cache --update $FileName$:$FileNameWithoutExtension$.css
    

    and output paths to refresh

    $FileNameWithoutExtension$.css
    
  2. Convert style.scssto compressed style.min.cssset the arguments

    --no-cache --update $FileName$:$FileNameWithoutExtension$.min.css --style compressed
    

    and output paths to refresh

    $FileNameWithoutExtension$.min.css
    
  1. 转换style.scssstyle.css设置参数

    --no-cache --update $FileName$:$FileNameWithoutExtension$.css
    

    和输出路径刷新

    $FileNameWithoutExtension$.css
    
  2. 转换style.scss为压缩style.min.css集参数

    --no-cache --update $FileName$:$FileNameWithoutExtension$.min.css --style compressed
    

    和输出路径刷新

    $FileNameWithoutExtension$.min.css
    

回答by Olivier Loynet

If you're using compass:

如果您使用指南针:

compass watch --output-style compressed