Class: Select2Foundation::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Select2Foundation::Generators::InstallGenerator
- Defined in:
- lib/generators/select2_foundation/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_assets ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/generators/select2_foundation/install_generator.rb', line 10 def add_assets create_app_scss true insert_into_file File.join(stylesheets_base_dir, "application#{detect_css_format[0]}"), "#{detect_css_format[1]} require select2/select2-foundation\n", :after => "foundation_and_overrides\n" if not .singular? insert_into_file File.join(stylesheets_base_dir, "_settings_select2.scss"), "\n@import 'settings';\n@import 'foundation';\n", :after => "// foundation settings" end end |
#create_app_scss(call = false) ⇒ Object
30 31 32 33 34 |
# File 'lib/generators/select2_foundation/install_generator.rb', line 30 def create_app_scss(call=false) if call template "_settings_select2.scss", File.join(stylesheets_base_dir, "_settings_select2.scss") end end |
#detect_css_format ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/select2_foundation/install_generator.rb', line 18 def detect_css_format %w(.css .css.sass .sass .css.scss .scss).each do |ext| if File.exist?(File.join(stylesheets_base_dir, "application#{ext}")) if ext.include?(".sass") || ext.include?(".scss") return [ext, "//="] else return [ext, " *="] end end end end |