Sha256: 831a12e7f603c3d2eaf7b4c10c7c1dfc1e8f6ccdfaa65cd07c720fff0f251728

Contents?: true

Size: 1.16 KB

Versions: 19

Compression:

Stored size: 1.16 KB

Contents

module TwbsLessRails
  module Generators
    class InstallGenerator < ::Rails::Generators::Base

      source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
      desc "This generator installs Bootstrap to Asset Pipeline"

      def copy_assets
        js_manifest = 'app/assets/javascripts/application.js'
        if File.exist?(File.join(destination_root, js_manifest))
          insert_into_file js_manifest, "//= require twbs/bootstrap\n", after: "jquery_ujs\n"
        else
          copy_file 'application.js', js_manifest
        end

        css_manifest = 'app/assets/stylesheets/application.css'
        if File.exist?(File.join(destination_root, css_manifest))
          insert_into_file css_manifest, " *= stub twbs-variables\n *= require twbs\n", after: "require_self\n"
        else
          copy_file 'application.css', css_manifest
        end
      end

      def copy_bootstrap
        copy_file 'twbs.js.coffee', 'app/assets/javascripts/twbs.js.coffee'
        copy_file 'twbs-variables.css.less', 'app/assets/stylesheets/twbs-variables.css.less'
        copy_file 'twbs.css.less', 'app/assets/stylesheets/twbs.css.less'
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
twbs_less_rails-2.10.1 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.10.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.9.1 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.9.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.8.3 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.8.2 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.8.1 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.7.2 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.7.1 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.7.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.6.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.5.1 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.5.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.4.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.3.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.2.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.1.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-2.0.0 lib/generators/twbs_less_rails/install/install_generator.rb
twbs_less_rails-1.0.2 lib/generators/twbs_less_rails/install/install_generator.rb