2014-11-24 46 views

回答

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 
+0

這聽起來像你真正尋找的是一個方法來創建既適合開發CSS(output_style =:嵌套)和生產準備的CSS(:output_style =>:壓縮)。而不是使用Compass,請看Grunt(http://www.sitepoint.com/writing-awesome-build-script-grunt/)或Gulp(http://markgoodyear.com/2014/01/getting -started與 - 咽/) – 2014-11-26 03:03:54