简体   繁体   English

是否可以在PhpStorm File Watcher中将SCSS编译为CSS并创建缩小的CSS?

[英]Is it possible in PhpStorm File Watcher to compile SCSS to CSS AND create minified css?

There is a --style compressed argument for compile minified css (fe compiling minified css described here ). 有一个--style compressed参数来编译--style compressed CSS( 此处介绍编译最小化的CSS)。 But is it possible to compile .css AND .min.css at the same time? 但是可以同时编译.css和.min.css吗?

Or I should create separate minify file watcher? 还是我应该创建单独的minify文件监视程序? (I tried to create 2 scss file watcher, one for .css and second for .min.css, but the second one replaced the first one, and I got only minified css). (我尝试创建2个scss文件监视程序,一个用于.css,第二个用于.min.css,但是第二个替换了第一个,而我只得到了缩小的css)。

Possible solutions: 可能的解决方案:

  1. Create 2 files watchers - SCSS->CSS and CSS->MIN.CSS . 创建2个文件监视程序SCSS->CSSCSS->MIN.CSS Use any available CSS uglifier for the second one - YUI Compressor , for example. 例如,将任何可用的CSS uglifier用于第二个-YUI Compressor See https://www.jetbrains.com/help/webstorm/2016.3/minifying-css.html 参见https://www.jetbrains.com/help/webstorm/2016.3/minifying-css.html

  2. create a batch script that does the job (calls SCSS compiler for your .scss and then compresses the resultant CSS) and set it up as a file watcher 创建一个完成该任务的批处理脚本(为您的.scss调用SCSS编译器,然后压缩生成的CSS)并将其设置为文件查看器

  3. Use Gulp/Grunt tasks to compile and minify your files. 使用Gulp / Grunt任务来编译和缩小文件。 You can either set up Gulp/Grunt as file watchers, or use Gulp/Grunt watch tasks 您可以将Gulp / Grunt设置为文件监视程序,也可以使用Gulp / Grunt watch任务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM