Class: ReactWebpackRails::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/react_webpack_rails/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_layoutObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/react_webpack_rails/install_generator.rb', line 8

def generate_layout
  copy_file '.babelrc', '.babelrc'
  copy_file 'webpack.config.js', 'webpack.config.js'
  copy_file 'webpack/dev.config.js', 'webpack/dev.config.js'
  copy_file 'webpack/hot-dev.config.js', 'webpack/hot-dev.config.js'
  copy_file 'webpack/production.config.js', 'webpack/production.config.js'
  copy_file 'karma.conf.js', 'karma.conf.js'
  copy_file 'webpack/tests.config.js', 'webpack/tests.config.js'
  copy_file 'partial/_react_hot_assets.html.erb', 'app/views/layouts/_react_hot_assets.html.erb'
  template 'react/index.js.erb', 'app/react/index.js'
  create_file 'app/assets/javascripts/react_bundle.js'
  if options.example
    copy_file 'react/components/hello-world.jsx', 'app/react/components/hello-world.jsx'
    copy_file 'react/components/hello-world-test.jsx', 'app/react/components/hello-world-test.jsx'
  else
    create_file 'app/react/components/.keep'
  end
  template 'package.json.erb', 'package.json'
end