Sha256: fd4dd637a885cc9786056a78a87c03710b4acaefd7742269c6b25419e7fd12ac

Contents?: true

Size: 1.17 KB

Versions: 60

Compression:

Stored size: 1.17 KB

Contents

require 'rails/generators'

module Pageflow
  module Generators
    class AssetsGenerator < Rails::Generators::Base
      desc "Install the pageflow assets."

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

      def create_assets
        template 'editor.js', 'app/assets/javascripts/pageflow/editor.js'
        template 'editor.scss', 'app/assets/stylesheets/pageflow/editor.scss'

        template 'application.js', 'app/assets/javascripts/pageflow/application.js'
        template 'application.scss', 'app/assets/stylesheets/pageflow/application.scss'

        template 'components.js', 'app/assets/javascripts/components.js'

        append_to_file 'app/assets/javascripts/active_admin.js.coffee' do
          "#= require pageflow/admin\n"
        end

        append_to_file 'app/assets/stylesheets/active_admin.scss' do
          "@import \"pageflow/admin\";\n"
        end
      end

      def initialize_on_precompile
        inject_into_file 'config/application.rb', after: "class Application < Rails::Application\n" do
          "    # required for i18n-js gem\n" +
          "    config.assets.initialize_on_precompile = true\n\n"
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
pageflow-14.5.2 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.1.0.beta2 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.1.0.beta1 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.2 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.1 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.0 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.5.1 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.5.0 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.0.rc2 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.0.rc1 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.0.beta4 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.0.beta3 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.4.0 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.0.beta2 lib/generators/pageflow/assets/assets_generator.rb
pageflow-15.0.0.beta1 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.3.0 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.2.1 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.2.0 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.1.1 lib/generators/pageflow/assets/assets_generator.rb
pageflow-14.1.0 lib/generators/pageflow/assets/assets_generator.rb