Skip to content
Use modern JavaScript build system in Rails.
Branch: master
Clone or download
hokaccha Merge pull request #2 from hokaccha/dependabot/npm_and_yarn/example/p…
…ostcss/lodash.template-4.5.0

Bump lodash.template from 4.4.0 to 4.5.0 in /example/postcss
Latest commit 1ca4118 Jul 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin bundle gem simpacker Jun 18, 2019
example Bump lodash.template from 4.4.0 to 4.5.0 in /example/postcss Jul 18, 2019
lib v1.1.0 Jul 3, 2019
test Improve error handling Jul 3, 2019
.gitignore Ignore Gemfile.lock Jun 19, 2019
.travis.yml Enable travis CI Jun 29, 2019
CHANGELOG.md v1.1.0 Jul 3, 2019
Gemfile bundle gem simpacker Jun 18, 2019
README.md Merge branch 'master' into patch-1 Jul 8, 2019
Rakefile Add test Jun 23, 2019
simpacker.gemspec Add test Jun 23, 2019

README.md

Simpacker

Build Status 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

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.

You can’t perform that action at this time.