Class: Rack::SassCompiler
- Inherits:
-
AssetCompiler
- Object
- AssetCompiler
- Rack::SassCompiler
- Defined in:
- lib/rack/sass_compiler.rb
Constant Summary
Constants inherited from AssetCompiler
Instance Attribute Summary collapse
-
#syntax ⇒ Object
Returns the value of attribute syntax.
Attributes inherited from AssetCompiler
#source_dir, #source_extension, #url
Instance Method Summary collapse
- #compile(source_file) ⇒ Object
-
#initialize(app, options = {}) ⇒ SassCompiler
constructor
A new instance of SassCompiler.
Methods inherited from AssetCompiler
Constructor Details
#initialize(app, options = {}) ⇒ SassCompiler
Returns a new instance of SassCompiler.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rack/sass_compiler.rb', line 8 def initialize(app, ={}) = { :url => '/stylesheets', :content_type => 'text/css', :syntax => :scss }.merge() @syntax = [:syntax] [:source_extension] ||= syntax.to_s super end |
Instance Attribute Details
#syntax ⇒ Object
Returns the value of attribute syntax.
6 7 8 |
# File 'lib/rack/sass_compiler.rb', line 6 def syntax @syntax end |
Instance Method Details
#compile(source_file) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rack/sass_compiler.rb', line 22 def compile(source_file) = { :syntax => syntax, :cache => false, :load_paths => [source_dir] } Sass::Engine.new(::File.read(source_file), ).render end |