简体   繁体   English

PhpStorm和SCSS将CSS文件编译为一个CSS文件

[英]PhpStorm and SCSS compile scss file into one css file

I'm taking my first steps in PhpStorm and SASS. 我正在PhpStorm和SASS中迈出第一步。 I went to File > Settings > File Watcher and I added SCSS 我转到“文件”>“设置”>“文件监视程序”,并添加了SCSS

This is my current configuration: 这是我当前的配置:

  • Program: C:\\Ruby23\\bin\\scss.bat 程式: C:\\Ruby23\\bin\\scss.bat

  • Arguments: --no-cache --update $FileName$:$FileParentDir$\\$FileNameWithoutExtension$.css 参数: --no-cache --update $FileName$:$FileParentDir$\\$FileNameWithoutExtension$.css

  • Working directory: $FileDir$ 工作目录: $FileDir$

  • Output paths to refresh: $FileParentDir$\\$FileNameWithoutExtension$.css 刷新的输出路径: $FileParentDir$\\$FileNameWithoutExtension$.css

And it's working in the following way. 它的工作方式如下。 Given the structure: 给出结构:

/mysite
    /sass
        1.scss
        2.scss
        3.scss

when I add a SCSS file to /sass it generates .css and .css.map files inside /mysite . 当我将SCSS文件添加到/sass它会在/mysite内部生成.css.css.map文件。 However, I want to generate just one CSS file inside /mysite and avoid the map files. 但是,我只想在/mysite内部生成一个CSS文件,并避免使用映射文件。 How can I do this? 我怎样才能做到这一点?

  1. if you have a primary SCSS file that imports other files (partials, their names usually start with underscore), you just need to make sure that ' Track only root files ' is enabled in File watcher settings to get the output merged into a single .css 如果您有一个导入其他文件的主要SCSS文件(部分文件,其名称通常以下划线开头),则只需确保在File watcher设置中启用了“ Track only root files ”,以将输出合并为一个文件。的CSS

  2. If you don't like .map files being created, pass --sourcemap=none to compiler 如果您不喜欢创建.map文件,请将--sourcemap=none传递给编译器

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

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