Module: Nesta::Overrides::Renderers
- Defined in:
- lib/nesta/overrides.rb
Instance Method Summary collapse
- #find_template(views, name, engine, &block) ⇒ Object
- #sass(template, options = {}, locals = {}) ⇒ Object
- #scss(template, options = {}, locals = {}) ⇒ Object
- #stylesheet(template, options = {}, locals = {}) ⇒ Object
Instance Method Details
#find_template(views, name, engine, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/nesta/overrides.rb', line 4 def find_template(views, name, engine, &block) user_paths = [ Nesta::Overrides.local_view_path, Nesta::Overrides.theme_view_path, views ].flatten.compact user_paths.each do |path| super(path, name, engine, &block) end end |
#sass(template, options = {}, locals = {}) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/nesta/overrides.rb', line 22 def sass(template, = {}, locals = {}) find_template(Nesta::App.settings.views, template, Tilt::SassTemplate) do |file| return Tilt.new(file).render if File.exist?(file) end raise IOError, "Sass template not found: #{template}" end |
#scss(template, options = {}, locals = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/nesta/overrides.rb', line 15 def scss(template, = {}, locals = {}) find_template(Nesta::App.settings.views, template, Tilt::ScssTemplate) do |file| return Tilt.new(file).render if File.exist?(file) end raise IOError, "SCSS template not found: #{template}" end |
#stylesheet(template, options = {}, locals = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/nesta/overrides.rb', line 29 def stylesheet(template, = {}, locals = {}) scss(template, , locals) rescue IOError sass(template, , locals) end |