Class: Mill::Resource::Stylesheet

Inherits:
Mill::Resource show all
Defined in:
lib/mill/resources/stylesheet.rb

Constant Summary collapse

FileTypes =
%w{
  text/css
}

Instance Attribute Summary

Attributes inherited from Mill::Resource

#content, #date, #input_file, #output_file, #public, #site, #type

Instance Method Summary collapse

Methods inherited from Mill::Resource

#absolute_uri, #build, #change_frequency, #final_content, #find_sibling_resources, #initialize, #inspect, #parent_uri, #public?, #save, #tag_uri, #uri

Constructor Details

This class inherits a constructor from Mill::Resource

Instance Method Details

#loadObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mill/resources/stylesheet.rb', line 11

def load
  super
  unless @input_file.basename.to_s.end_with?('.min.css')
    engine = Sass::Engine.for_file(@input_file.to_s, syntax: :scss, style: :compressed)
    begin
      @content = engine.render
    rescue Sass::SyntaxError => e
      raise "#{input_file}: error parsing CSS: #{e}"
    end
  end
end