where to put gem script files for compass (css_splitter)

老子叫甜甜 提交于 2020-01-06 08:57:13

问题


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:

  1. The sass config file is under: D:\myapp\mainsite\sass\config.rb
  2. I put css_splitter.rake and css_splitter.rb into the folder above.
  3. 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
  1. When i compiled project, the error I got was: LoadError on line 36 of D: no such file to load -- css_splitter

  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!