Return to Snippet

Revision: 7325
at July 17, 2008 17:36 by vanne


Initial Code
  # compiles all the css files into one huge string
  # this is useful when running with less
  # USAGE : all_css.open # => opens the string in less allowing you to search
  def all_css
    css_files = Dir.glob File.join(RAILS_ROOT, "public/stylesheets/","*.css")
    css_content = ""
    css_files.each {|file| css_content << IO.read(file)}
    
    css_content.instance_eval do
      
      # opens with less command
      def open
        system('echo "' << self << '"|less')
      end
      
    end
    
    css_content
  end

Initial URL

                                

Initial Description

                                

Initial Title
Compile all css files in a rails project

Initial Tags
textmate, rails, ruby

Initial Language
Other