winton / stasis

Static sites made powerful
http://stasis.me
MIT License
679 stars 56 forks source link

How to pass options to haml and sass? #10

Closed dteoh closed 13 years ago

dteoh commented 13 years ago

Title.

dteoh commented 13 years ago

Well, for now my solution is to monkey patch Tilt templates...

In my controller.rb:

class Tilt::HamlTemplate
  def prepare
    options = @options.merge(:filename => eval_file, :line => line)
    # Custom options
    options = options.merge :ugly => true
    @engine = ::Haml::Engine.new(data, options)
  end
end
winton commented 13 years ago

Thanks for the contribution!

phallstrom commented 11 years ago

Just now running into this same issue and about the time I found this post, I also found another solution, which feels a little cleaner... put this in controller.rb...

Tilt.prefer Class.new(Tilt::SassTemplate){ def options; {:style => :compressed}; end }, 'scss'