Project

simpacker

0.07
The project is in a healthy, maintained state
Integrate modern JavaScript build system with Rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.16
>= 5.1
>= 5.2
>= 10.0

Runtime

>= 4.2
 Project Readme

Simpacker

CI Gem Version

Simpacker provides the feature to integrate modern JavaScript build system with Rails, like a webpacker.

Installation

Create a new rails application without webpacker.

$ rails new myapp --skip-javascript

Add this line to your application's Gemfile:

gem 'simpacker'

Run the following to install Simpacker:

$ rails simpacker:install

Add javascript_pack_tag in view.

<%= javascript_pack_tag 'application' %>

Run the folloing command to build JavaScript.

$ ./node_modules/.bin/webpack --watch

Examples

VS. Webpacker

Webpacker is a great product that you can easily use webpack without knowing it. It also provides many useful features. The difficulty with Webpacker is that you need to configure webpack via webpacker's own DSL and webpacker.yml. If you know how to configure webpack, you need to convert it to webpacker configuration. I want to edit webpack.config.js directly!

Simpacker provides only minimal features that lookup the manifest.json output by webpack and a create script tag through javascript_pack_tag. You need to know about webpack, but there is little to know about Simpacker.

However, some useful features of Webpacker, such as yarn integrity and compilation on request, are not available in Simpacker.

Deployment

Simpacker does not provide feature for deployment. Just run the following command at deployment.

$ npm install
$ NODE_ENV=production ./node_modules/.bin/webpack

See also: CDN, Heroku, Docker

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hokaccha/simpacker.

License

The gem is available as open source under the terms of the MIT License.