Sha256: e3bdc8f6d090c7f27ae9bae9974a7511b4ffe990b2c9e1d53199a039ed173d2d

Contents?: true

Size: 728 Bytes

Versions: 8

Compression:

Stored size: 728 Bytes

Contents

require 'rails/generators'

module IiifPrint
  class AssetsGenerator < Rails::Generators::Base
    desc "This generator installs the iiif_print CSS assets into your application"

    source_root File.expand_path('../templates', __FILE__)

    def inject_css
      copy_file "iiif_print.scss", "app/assets/stylesheets/iiif_print.scss"
    end

    def inject_js
      return if iiif_print_js_installed?
      insert_into_file 'app/assets/javascripts/application.js', after: '//= require hyrax' do
        <<-JS.strip_heredoc

        //= require iiif_print
        JS
      end
    end

    private

    def iiif_print_js_installed?
      IO.read("app/assets/javascripts/application.js").include?('iiif_print')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
iiif_print-3.0.3 lib/generators/iiif_print/assets_generator.rb
iiif_print-3.0.2 lib/generators/iiif_print/assets_generator.rb
iiif_print-3.0.1 lib/generators/iiif_print/assets_generator.rb
iiif_print-3.0.0 lib/generators/iiif_print/assets_generator.rb
iiif_print-2.0.1 lib/generators/iiif_print/assets_generator.rb
iiif_print-2.0.0 lib/generators/iiif_print/assets_generator.rb
iiif_print-1.1.0 lib/generators/iiif_print/assets_generator.rb
iiif_print-1.0.0 lib/generators/iiif_print/assets_generator.rb