aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/rails/assets/assets_generator.rb
blob: 6f4b86e708a5ac8b7ea7437aa2179d371f05d5b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Rails
  module Generators
    class AssetsGenerator < NamedBase # :nodoc:
      class_option :javascripts, type: :boolean, desc: "Generate JavaScripts"
      class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets"

      class_option :javascript_engine, desc: "Engine for JavaScripts"
      class_option :stylesheet_engine, desc: "Engine for Stylesheets"

      protected

      def asset_name
        file_name
      end

      hook_for :javascript_engine do |javascript_engine|
        invoke javascript_engine, [name] if options[:javascripts]
      end

      hook_for :stylesheet_engine do |stylesheet_engine|
        invoke stylesheet_engine, [name] if options[:stylesheets]
      end
    end
  end
end