Module: Fewer::RailsHelpers
- Defined in:
- lib/fewer/rails_helpers.rb
Instance Method Summary collapse
- #fewer_encode_sources(app, sources, friendly_ext = nil) ⇒ Object
- #fewer_javascripts_tag(*sources) ⇒ Object
- #fewer_stylesheets_tag(*sources) ⇒ Object
Instance Method Details
#fewer_encode_sources(app, sources, friendly_ext = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fewer/rails_helpers.rb', line 3 def fewer_encode_sources(app, sources, friendly_ext = nil) ext = app.engine_klass.extension sources.map! { |source| ext && source[-ext.length, ext.length] != ext ? "#{source}#{ext}" : source } if config.perform_caching engine = app.engine(sources) ["#{engine.mtime.to_i.to_s(36)}/#{engine.encoded}#{friendly_ext}"] else sources.map { |source| engine = app.engine([source]) friendly_name = File.basename(source, '.*') "#{engine.mtime.to_i.to_s(36)}/#{engine.encoded}-#{friendly_name}#{friendly_ext}" } end end |
#fewer_javascripts_tag(*sources) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/fewer/rails_helpers.rb', line 21 def fewer_javascripts_tag(*sources) = sources. .delete(:cache) app = Fewer::App[:javascripts] javascript_include_tag fewer_encode_sources(app, sources, '.js'), end |
#fewer_stylesheets_tag(*sources) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/fewer/rails_helpers.rb', line 28 def fewer_stylesheets_tag(*sources) = sources. .delete(:cache) app = Fewer::App[:stylesheets] stylesheet_link_tag fewer_encode_sources(app, sources, '.css'), end |