Class: Rack::SassC
- Inherits:
-
Object
- Object
- Rack::SassC
- Defined in:
- lib/rack/sassc.rb,
lib/rack/sassc/version.rb
Constant Summary collapse
- VERSION =
'0.1.0'
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #filepath(filename, type) ⇒ Object
-
#initialize(app, opts = {}) ⇒ SassC
constructor
A new instance of SassC.
Constructor Details
#initialize(app, opts = {}) ⇒ SassC
Returns a new instance of SassC.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rack/sassc.rb', line 8 def initialize app, opts={} @app = app @opts = { check: ENV['RACK_ENV'] != 'production', syntax: :scss, css_location: 'public/css', scss_location: 'public/scss', create_map_file: true, }.merge(opts) @opts[:css_location] = ::File. @opts[:css_location] @opts[:scss_location] = ::File. @opts[:scss_location] end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
6 7 8 |
# File 'lib/rack/sassc.rb', line 6 def opts @opts end |
Instance Method Details
#call(env) ⇒ Object
23 24 25 26 |
# File 'lib/rack/sassc.rb', line 23 def call env handle_path(env['PATH_INFO']) if must_check?(env) @app.call env end |
#filepath(filename, type) ⇒ Object
28 29 30 31 32 |
# File 'lib/rack/sassc.rb', line 28 def filepath filename, type location = @opts[type==:css ? :css_location : :scss_location] ext = type==:scss ? @opts[:syntax] : type ::File.join location, "#{filename}.#{ext}" end |