1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add option to trigger JS framework-specific installation as part of webpack setup

This commit is contained in:
David Heinemeier Hansson 2016-12-12 11:07:28 -08:00
parent 5d07e8a326
commit cfdf6e1368
2 changed files with 17 additions and 2 deletions

View file

@ -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*

View file

@ -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