Webpacker

forked from Webpacker

Use Webpack to manage app-like JavaScript modules in Rails. 
javascript 1,127 0


Dave Kimura
Dave Kimura

May 13, 2020

Copy and paste this code into your terminal

DISCLAIMER: You should always review templates before running them. By running the template, you are agreeing to the terms of use.

The contents of this script as show. Any updates will be reflected in the below code and the snippet.

gem 'webpacker'
rails_command("webpacker:install")

def print_green(heredoc)
  puts set_color heredoc, :green
end

print_green <<~DOC
CONGRATS ON FINISHING THE INSTALLATION

Here are some additional notes to complete the installation. These steps are
not automatically generated due to layouts being often heavily modified.

Add these to the appropriate layout file, like app/views/layouts/application.html.erb

<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>

To run the local webpack dev server, run

bin/webpack-dev-server

For additional documentation, check out https://github.com/rails/webpacker
DOC

A place where you can thank the author, post problems, give constructive feedback, etc. Be nice!

  • Dave Kimura
    This is a good example of creating and using methods within templates. The "print_green" is using Thor Shell colors.
    by Dave Kimura at 1:26PM, 13 May 2020