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, #node, #output_file, #path, #public, #site

Instance Method Summary collapse

Methods inherited from Mill::Resource

#absolute_uri, #build, #change_frequency, #children, #final_content, #initialize, #inspect, #parent, #public?, #redirect?, #save, #siblings, #tag_uri, #text?, #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
# File 'lib/mill/resources/stylesheet.rb', line 11

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