forked from rails/webpacker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.rb
33 lines (24 loc) · 922 Bytes
/
template.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Install webpacker
copy_file "#{__dir__}/config/webpacker.yml", "config/webpacker.yml"
puts "Copying webpack core config and loaders"
directory "#{__dir__}/config/webpack", "config/webpack"
puts "Copying .postcssrc.yml to app root directory"
copy_file "#{__dir__}/config/.postcssrc.yml", ".postcssrc.yml"
puts "Copying .babelrc to app root directory"
copy_file "#{__dir__}/config/.babelrc", ".babelrc"
puts "Creating javascript app source directory"
directory "#{__dir__}/javascript", Webpacker.config.source_path
puts "Installing binstubs"
run "bundle binstubs webpacker"
if File.exists?(".gitignore")
append_to_file ".gitignore", <<-EOS
/public/packs
/public/packs-test
/node_modules
EOS
end
puts "Installing all JavaScript dependencies"
run "yarn add @rails/webpacker"
puts "Installing dev server for live reloading"
run "yarn add --dev webpack-dev-server"
puts "Webpacker successfully installed 🎉 🍰"