问题
first time working with gem/ruby files. need a bit of help here.
Basically we have asp.net application that uses SASS + COMPASS.
To address css file size limitation, we wanted to use css_splitter script (css_splitter.rake and css_splitter.rb): https://gist.github.com/1131536
Basically, after compass compiles, splitter should kick in and split the generated css file into 2 or more.
What I have tired:
- The sass config file is under: D:\myapp\mainsite\sass\config.rb
- I put css_splitter.rake and css_splitter.rb into the folder above.
- modified config.rb to reference to "css_splitter.rb" as follow:
require 'susy' require 'css_splitter' http_path = "/" css_dir = "../stylesheets" sass_dir = "" images_dir = "../img" javascripts_dir = "../Scripts" sass_options = {:full_exception => true } output_style = :compressed line_comments = false on_stylesheet_saved do |path| CssSplitter.split(path) unless path[/\d+$/] end
When i compiled project, the error I got was: LoadError on line 36 of D: no such file to load -- css_splitter
I also notice there is a D:\myapp\sass\ruby\lib\ruby\site_ruby\1.8 folder, I put css_splitter.rake and css_splitter.rb into that folder too, but good the same error.
Anyone has any idea? Thanks.
回答1:
Don't bother with rake. The easiest way to do this is to copy and paste the entire Module CssSplitter into your config.rb file, and change Module to class.
Then at the bottom, add the on_stylesheet_saved method override. something like this: https://gist.github.com/3559165
This may not be the ideal configuration, but it works. It should give you Screen, Screen_2, Screen_3 ...etc in your stylesheets dir. Let me know if you make any progress!
来源:https://stackoverflow.com/questions/12066206/where-to-put-gem-script-files-for-compass-css-splitter