diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2016-12-12 11:07:28 -0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2016-12-12 11:07:28 -0800 |
commit | cfdf6e13689c67a108b1f3980f59a4e3933369c3 (patch) | |
tree | c426e0a5deb4e79624c7e3226a9dbd29457d2082 /railties | |
parent | 5d07e8a326e3f1bd46228fbf4f1e59054eced62e (diff) | |
download | rails-cfdf6e13689c67a108b1f3980f59a4e3933369c3.tar.gz rails-cfdf6e13689c67a108b1f3980f59a4e3933369c3.tar.bz2 rails-cfdf6e13689c67a108b1f3980f59a4e3933369c3.zip |
Add option to trigger JS framework-specific installation as part of webpack setup
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 12 | ||||
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 7 |
2 files changed, 17 insertions, 2 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 0ba220104a..8a1a440fca 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,15 @@ +* Add Webpack support in new apps via the --webpack option, which will delegate to the rails/webpacker gem. + + To generate a new app that has Webpack dependencies configured and binstubs for webpack and webpack-watcher: + + rails new myapp --webpack + + To generate a new app that has Webpack + React configured and an example intalled: + + rails new myapp --webpack=react + + *DHH* + * Add Yarn support in new apps with a yarn binstub and vendor/package.json. Skippable via --skip-yarn option. *Liceth Ovalles*, *Guillermo Iguaran*, *DHH* diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 576c36fc86..b94630de15 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -33,7 +33,7 @@ module Rails class_option :javascript, type: :string, aliases: "-j", desc: "Preconfigure for selected JavaScript library" - class_option :webpack, type: :boolean, default: false, + class_option :webpack, type: :string, default: "base", desc: "Preconfigure for app-like JavaScript with Webpack" class_option :skip_yarn, type: :boolean, default: false, @@ -426,7 +426,10 @@ module Rails end def run_webpack - rails_command "webpacker:install" if options[:webpack] + if !(webpack = options[:webpack]).nil? + rails_command "webpacker:install" + rails_command "webpacker:install:#{webpack}" unless webpack == "base" + end end def generate_spring_binstubs |