Class: NpmPipeline::Generators::WebpackGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- NpmPipeline::Generators::WebpackGenerator
- Defined in:
- lib/generators/npm_pipeline/webpack_generator.rb
Instance Method Summary collapse
Instance Method Details
#copy_files ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/npm_pipeline/webpack_generator.rb', line 9 def copy_files [ 'package.json', 'yarn.lock', 'webpack.config.js', 'app/webpack/css/app.js', 'app/webpack/css/components/example.scss', 'app/webpack/js/app.js', 'app/webpack/js/behaviors/example.js' ].each { |f| template f, f } end |
#update_assets ⇒ Object
21 22 23 24 25 26 |
# File 'lib/generators/npm_pipeline/webpack_generator.rb', line 21 def update_assets append_to_file 'app/assets/stylesheets/application.css', "/*\n *= require webpack/app\n */\n" append_to_file 'app/assets/javascripts/application.js', "//= require webpack/app\n" end |
#update_gitignore ⇒ Object
28 29 30 31 32 33 |
# File 'lib/generators/npm_pipeline/webpack_generator.rb', line 28 def update_gitignore append_to_file '.gitignore', "\n/node_modules" + "\n/vendor/assets/stylesheets/webpack" + "\n/vendor/assets/javascripts/webpack\n" end |