Posted By

vanne on 07/17/08


Tagged

textmate rails ruby console irb


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

lfatr


Compile all css files in a rails project


 / Published in: Other
 

  1. # compiles all the css files into one huge string
  2. # this is useful when running with less
  3. # USAGE : all_css.open # => opens the string in less allowing you to search
  4. def all_css
  5. css_files = Dir.glob File.join(RAILS_ROOT, "public/stylesheets/","*.css")
  6. css_content = ""
  7. css_files.each {|file| css_content << IO.read(file)}
  8.  
  9. css_content.instance_eval do
  10.  
  11. # opens with less command
  12. def open
  13. system('echo "' << self << '"|less')
  14. end
  15.  
  16. end
  17.  
  18. css_content
  19. end
  20.  

Report this snippet  

You need to login to post a comment.