jsbundling-rails 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0ef32480b80f6c274f0bb59e0785cf22aa157b19e688fcbebbe4544d195c81e
4
- data.tar.gz: 131dffe9aa231f4a456452a3b9ba67f0d91d2079ebd3102a43c30c63bdc5f2a0
3
+ metadata.gz: 709473c1e464dc72e16f938fba464de26e746a7c7a7bb599d4e55e5b5d3084e7
4
+ data.tar.gz: ee9e7ac72bc4e5642b603773763b9d1dbf1ad11f5f21ea562125bbc26e68cb79
5
5
  SHA512:
6
- metadata.gz: 22aa53c9b71baa3704f447ea717f9ccd2d7b489dbb17eb0885dd65fb94bb3d678ec15a5d74589c4c5c5ec8bbc89603cc2963b978f38047d28ba02b15b45d9638
7
- data.tar.gz: db1a29cb7d04cf0e61cfdc0b03f44ffe766d12936ef7c5147cd704297726724f7317fa7aa89737b6978c628b157c0454675b98e4530e3067ec14d54ee0f755f0
6
+ metadata.gz: 0dd2e4765b05d630f0b278b0c7d5a6e909e8f42a630888763535cb19d6d51f92429767bb3da9960904e1e32ebb29747d060135fbffe6562b382dfad07d8f3071
7
+ data.tar.gz: fbe17aa3c5ecae4d70643c6cd6e485b9c8df441de245fdc026b712d98da5494f428b68a4e92466819f3abfc904b3c7ac40f73fbb09637a465c37028a897a0583
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # JavaScript Bundling for Rails
2
2
 
3
- Use [esbuild](https://esbuild.github.io), [rollup.js](https://rollupjs.org), or [Webpack](https://webpack.js.org) to bundle your JavaScript, then deliver it via the asset pipeline in Rails. This gem provides installers to get you going with the bundler of your choice in a new Rails application, and a convention to use `app/assets/bundles` to hold your bundled output as artifacts that are not checked into source control (the installer adds this directory to `.gitignore` by default).
3
+ Use [esbuild](https://esbuild.github.io), [rollup.js](https://rollupjs.org), or [Webpack](https://webpack.js.org) to bundle your JavaScript, then deliver it via the asset pipeline in Rails. This gem provides installers to get you going with the bundler of your choice in a new Rails application, and a convention to use `app/assets/builds` to hold your bundled output as artifacts that are not checked into source control (the installer adds this directory to `.gitignore` by default).
4
4
 
5
- You develop using this approach by running the bundler in watch mode in a terminal with `yarn build --watch` (and your Rails server in another, if you're not using something like [puma-dev](https://github.com/puma/puma-dev)). Whenever the bundler detects changes to any of the JavaScript files in your project, it'll bundle `app/javascript/application.js` into `app/assets/bundles/javascript.js` (and all other entry points placed in the root of `app/javascript`). You can refer to the build output in your layout using the standard asset pipeline approach with `<%= javascript_include_tag "application" %>`.
5
+ You develop using this approach by running the bundler in watch mode in a terminal with `yarn build --watch` (and your Rails server in another, if you're not using something like [puma-dev](https://github.com/puma/puma-dev)). Whenever the bundler detects changes to any of the JavaScript files in your project, it'll bundle `app/javascript/application.js` into `app/assets/builds/javascript.js` (and all other entry points configured). You can refer to the build output in your layout using the standard asset pipeline approach with `<%= javascript_include_tag "application", defer: true %>`.
6
6
 
7
- When you deploy your application to production, the bundler attaches to the `assets:precompile` task to ensure that all your package dependencies from `package.json` have been installed via npm, and then runs `yarn build` to process all the entry points, as it would in development. The latter files are then picked up by the asset pipeline, digested, and copied into public/assets, as any other asset pipeline file.
7
+ When you deploy your application to production, the `javascript:build` task attaches to the `assets:precompile` task to ensure that all your package dependencies from `package.json` have been installed via yarn, and then runs `yarn build` to process all the entry points, as it would in development. The latter files are then picked up by the asset pipeline, digested, and copied into public/assets, as any other asset pipeline file.
8
8
 
9
9
  This also happens in testing where the bundler attaches to the `test:prepare` task to ensure the JavaScript has been bundled before testing commences. (Note that this currently only applies to rails `test:*` tasks (like `test:all` or `test:controllers`), not "rails test", as that doesn't load `test:prepare`).
10
10
 
11
11
  That's it!
12
12
 
13
- You can configure your bundler options in the `build` script in `package.json` or via the installer-generated rollup.config.js for rollup.js or webpack.config.json for Webpack (esbuild does not have a default configuration format).
13
+ You can configure your bundler options in the `build` script in `package.json` or via the installer-generated `rollup.config.js` for rollup.js or `webpack.config.json` for Webpack (esbuild does not have a default configuration format).
14
14
 
15
15
 
16
16
  ## Installation
@@ -19,11 +19,11 @@ You must already have node and yarn installed on your system. Then:
19
19
 
20
20
  1. Add `jsbundling-rails` to your Gemfile with `gem 'jsbundling-rails'`
21
21
  2. Run `./bin/bundle install`
22
- 3. Run `./bin/rails javascript:[rollup|esbuild|webpack]:install`
22
+ 3. Run `./bin/rails javascript:[esbuild|rollup|webpack]:install`
23
23
 
24
- Or, in Rails 7+, you can preconfigure your new application to use a specific bundler with `rails new myapp -j [rollup|esbuild|webpack]`.
24
+ Or, in Rails 7+, you can preconfigure your new application to use a specific bundler with `rails new myapp -j [esbuild|rollup|webpack]`.
25
25
 
26
26
 
27
27
  ## License
28
28
 
29
- rollup.js for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
29
+ JavaScript Bundling for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
@@ -9,11 +9,11 @@ end
9
9
 
10
10
  if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist?
11
11
  say "Add JavaScript include tag in application layout"
12
- insert_into_file app_layout_path.to_s,
13
- %(\n <%= javascript_include_tag "application", "data-track-turbo": "true", defer: true %>), before: /\s*<\/head>/
12
+ insert_into_file app_layout_path.to_s,
13
+ %(\n <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>), before: /\s*<\/head>/
14
14
  else
15
15
  say "Default application.html.erb is missing!", :red
16
- say %( Add <%= javascript_include_tag "application", "data-track-turbo": "true", defer: true %> within the <head> tag in your custom layout.)
16
+ say %( Add <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> within the <head> tag in your custom layout.)
17
17
  end
18
18
 
19
19
  unless (app_js_entrypoint_path = Rails.root.join("app/javascript/application.js")).exist?
@@ -1,3 +1,3 @@
1
1
  module Jsbundling
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsbundling-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson