We Recommend

Beginning AppleScript (Programmer to Programmer) Beginning AppleScript (Programmer to Programmer)
Geared toward programmers with no prior development knowledge, Beginning AppleScript serves as a comprehensive guide to using AppleScript on the Mac OS X platform. This title introduces the reader to AppleScript, and then illustrates how to efficiently start writing scripts through sample programs as each concept is introduced.


Posted By

vanne on 07/17/08


Tagged

textmate rails ruby console irb


Versions (?)


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.