Class: NpmPipeline::Generators::GulpGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- NpmPipeline::Generators::GulpGenerator
- Defined in:
- lib/generators/npm_pipeline/gulp_generator.rb
Instance Method Summary collapse
- #create_gulpfile ⇒ Object
- #create_package_json ⇒ Object
- #create_sample_css ⇒ Object
- #create_sample_js ⇒ Object
- #update_assets ⇒ Object
- #update_gitignore ⇒ Object
Instance Method Details
#create_gulpfile ⇒ Object
13 14 15 |
# File 'lib/generators/npm_pipeline/gulp_generator.rb', line 13 def create_gulpfile template 'gulpfile.js', 'gulpfile.js' end |
#create_package_json ⇒ Object
9 10 11 |
# File 'lib/generators/npm_pipeline/gulp_generator.rb', line 9 def create_package_json template 'package.json', 'package.json' end |
#create_sample_css ⇒ Object
24 25 26 27 |
# File 'lib/generators/npm_pipeline/gulp_generator.rb', line 24 def create_sample_css create_file 'app/gulp/css/example.css', %(html:before { content: 'Gulp assets added successfully! Edit app/gulp/example.css or remove it.'; display: block; padding: 20px; background: #ffc; color: #111; position: fixed; top: 16px; right: 16px; max-width: 600px; z-index: 10000; font-family: sans-serif; font-size: 14px; line-height: 1.6; }\n) end |
#create_sample_js ⇒ Object
29 30 31 32 |
# File 'lib/generators/npm_pipeline/gulp_generator.rb', line 29 def create_sample_js create_file 'app/gulp/js/example.js', "alert('Gulp works!')" end |
#update_assets ⇒ Object
17 18 19 20 21 22 |
# File 'lib/generators/npm_pipeline/gulp_generator.rb', line 17 def update_assets append_to_file 'app/assets/stylesheets/application.css', "/*\n *= require gulp/app\n */\n" append_to_file 'app/assets/javascripts/application.js', "//= require gulp/app\n" end |
#update_gitignore ⇒ Object
34 35 36 37 38 39 |
# File 'lib/generators/npm_pipeline/gulp_generator.rb', line 34 def update_gitignore append_to_file '.gitignore', "\n/node_modules" + "\n/vendor/assets/stylesheets/gulp" + "\n/vendor/assets/javascripts/gulp\n" end |