使Compass / Sass编译2 .css,每个都有不同的配置

时间:2014-11-24 23:37:33

标签: sass compass-sass

我希望罗盘能够编译2个不同的.css文件:1个       output_style = :nested 和一个         output_style = :compressed

因此,应编译filename_nested.css和filename_compressed.css。

我只是使用config.rb

1 个答案:

答案 0 :(得分:1)

config.rb:这似乎有效。我希望我不必在Compass.compiler.compile('main.scss', 'main.min.css')中规定scss我宁愿使用'文件'变量,但我还没有弄清楚如何。此外,我还没有弄清楚如何绕过这个已弃用的功能。 code found here

http_path = "/wp-content/themes/Harmony_child/css/"
css_dir = ""
sass_dir = ""
images_dir = "img"
javascripts_dir = "js"
fonts_dir = "fonts"
cache_path = "C:/Temp/sasscache"

output_style = :nested
output_style = :compact
line_comments = true
color_output = false  

require 'fileutils'

on_stylesheet_saved do |file|
  if file.match('.min') == nil
    require 'compass'

    Compass.add_configuration(
        {
            :output_style => :compressed
        },
        'min' #ADDING A CONFIG REQUIRES A NAME
    )
    Compass.compiler.compile('main.scss', 'main.min.css')
    #Compass.compiler is deprecated. Use Compass.sass_compiler instead.
    #Compass.sass_compiler('main.scss', 'main.min.css')
    #yabbut, it dont work. the deprecated one does...

  end
end