Posted By

vanne on 07/17/08


Tagged

textmate rails ruby console irb


Versions (?)


Advertising

Submit Site


Compile all css files in a rails project


Published in: Other 



Website Promotion
DIRECTORY
is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Expand | Embed | Plain Text
  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.

Download royalty free graphics