Sha256: bd3b552b63e62b5bb23f354227e71555f30d517437d5996c1ee8dfab68afcb4c

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

# Copy BlacklightRangeLimit assets to public folder in current app.
# If you want to do this on application startup, you can
# add this next line to your one of your environment files --
# generally you'd only want to do this in 'development', and can
# add it to environments/development.rb:
#       require File.join(BlacklightRangeLimit.root, "lib", "generators", "blacklight", "assets_generator.rb")
#       BlacklightRangeLimit::AssetsGenerator.start(["--force", "--quiet"])


# Need the requires here so we can call the generator from environment.rb
# as suggested above.
require 'rails/generators'
require 'rails/generators/base'
module BlacklightRangeLimit
  class AssetsGenerator < Rails::Generators::Base
    source_root File.join(BlacklightRangeLimit::Engine.root, 'app', 'assets')

    def assets
      application_css = Dir["app/assets/stylesheets/application{.css,.scss,.css.scss}"].first

      if application_css

        insert_into_file application_css, :before => "*/" do
%q{
 *
 * Used by blacklight_range_limit
 *= require  'blacklight_range_limit'
 *
}
        end
      else
        say_status "warning", "Can not find application.css, did not insert our require", :red
      end

      append_to_file "app/assets/javascripts/application.js" do
%q{

// For blacklight_range_limit built-in JS, if you don't want it you don't need
// this:
//= require 'blacklight_range_limit'

}
      end
      inject_into_file 'app/assets/javascripts/application.js', before: '// Required by Blacklight' do
        "\n//= require tether\n"
      end
    end



  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight_range_limit-7.0.1 lib/generators/blacklight_range_limit/assets_generator.rb
blacklight_range_limit-7.0.0 lib/generators/blacklight_range_limit/assets_generator.rb
blacklight_range_limit-7.0.0.rc2 lib/generators/blacklight_range_limit/assets_generator.rb
blacklight_range_limit-7.0.0.rc1 lib/generators/blacklight_range_limit/assets_generator.rb