Class: Skeletor::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Skeletor::Generators::InstallGenerator
- Defined in:
- lib/generators/skeletor/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_assets ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/skeletor/install_generator.rb', line 8 def add_assets insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require skeletor_backbone\n", :after => "jquery_ujs\n" # settings_file = File.read("#{SkeletorBackbone::css_path}/_settings.sass") # create_file "app/assets/stylesheets/skeletor_and_settings.sass", File.read(settings_file) `sass-convert --from sass --to scss "#{SkeletorBackbone::css_path}/_settings.sass" "app/assets/stylesheets/skeletor_backbone.scss"` append_to_file "app/assets/stylesheets/skeletor_backbone.scss", "\n@import \"skeletor\";\n" insert_into_file "app/assets/stylesheets/application#{detect_css_format[0]}", "\n#{detect_css_format[1]} require normalize \n#{detect_css_format[1]} require skeletor_backbone", :after => "require_self" end |
#detect_css_format ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/generators/skeletor/install_generator.rb', line 24 def detect_css_format return ['.css', ' *='] if File.exist?('app/assets/stylesheets/application.css') return ['.css.sass', '//='] if File.exist?('app/assets/stylesheets/application.css.sass') return ['.sass', '//='] if File.exist?('app/assets/stylesheets/application.sass') return ['.css.scss', '//='] if File.exist?('app/assets/stylesheets/application.css.scss') return ['.scss', '//='] if File.exist?('app/assets/stylesheets/application.scss') end |
#detect_js_format ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/skeletor/install_generator.rb', line 18 def detect_js_format return ['.coffee', '#='] if File.exist?('app/assets/javascripts/application.coffee') return ['.js.coffee', '#='] if File.exist?('app/assets/javascripts/application.js.coffee') return ['.js', '//='] if File.exist?('app/assets/javascripts/application.js') end |