Sha256: 251f9c2f9c1d63eb6b1fc1829c3a544b8b40c88b1946070ed248ec53b943314e
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
require 'slim-rails/version' require 'rails' require 'slim' module Slim module Rails class Railtie < ::Rails::Railtie config.app_generators.template_engine :slim initializer 'slim_rails.configure_template_digestor' do |app| if app.assets && app.assets.respond_to?(:register_engine) app.assets.register_engine '.slim', Slim::Template end ActiveSupport.on_load(:action_view) do ActiveSupport.on_load(:after_initialize) do begin if defined?(CacheDigests::DependencyTracker) # 'cache_digests' gem being used (overrides Rails 4 implementation) CacheDigests::DependencyTracker.register_tracker :slim, CacheDigests::DependencyTracker::ERBTracker if ::Rails.env.development? # recalculate cache digest keys for each request CacheDigests::TemplateDigestor.cache = ActiveSupport::Cache::NullStore.new end elsif ::Rails.version.to_s >= '4.0' # will only apply if Rails 4, which includes 'action_view/dependency_tracker' require 'action_view/dependency_tracker' ActionView::DependencyTracker.register_tracker :slim, ActionView::DependencyTracker::ERBTracker ActionView::Base.cache_template_loading = false if ::Rails.env.development? end rescue # likely this version of Rails doesn't support dependency tracking end end end end end end end Slim::Engine.set_options pretty: Rails.env.development?
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slim-rails-3.0.1 | lib/slim-rails.rb |