shakapacker 6.4.1 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -2
- data/Gemfile.lock +1 -1
- data/README.md +57 -43
- data/lib/webpacker/compiler.rb +39 -5
- data/lib/webpacker/helper.rb +22 -3
- data/lib/webpacker/version.rb +1 -1
- data/package.json +1 -1
- data/rakelib/release.rake +1 -0
- data/test/helper_test.rb +42 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b82b9f5ec11e2c2f705b17b2c36bcdc4446dc966c8f08ed0f620b9b0325b6a7a
|
|
4
|
+
data.tar.gz: 422c4152faf9cc24b1b10a84da9c5e2eda53c52c8a9369e2b01b7a4107a4cde0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: edbc0fc84e0cd99618aeacf63066f2e5bd4abb8a6f160a2d4b3dcfbb8ddd50879add52a4acce0d25c559801b017c20bc8a1d32e2667a97672b383ec668468786
|
|
7
|
+
data.tar.gz: 9d3ba188baa5731713e472f11dd812ef8a0f33ac6e6cea3ce84c1984c0b3073bec3eefccb5728b5181164db61db1e363cde7affce2a3d3a8d3dce433c7171e58
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
* For the changelog of versions prior to v6, see the [5.x stable branch of rails/webpacker](https://github.com/rails/webpacker/tree/5-x-stable).
|
|
2
2
|
* Please see the [v6 Upgrade Guide](./docs/v6_upgrade.md) to go from versions prior to v6.
|
|
3
|
-
* [ShakaCode](https://www.shakacode.com) offers support for upgrading from webpacker or using Shakapacker. If interested, contact [justin@shakacode.com](mailto:justin@shakacode.com).
|
|
3
|
+
* [ShakaCode](https://www.shakacode.com) offers support for upgrading from webpacker or using Shakapacker. If interested, contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com).
|
|
4
4
|
|
|
5
5
|
## Versions
|
|
6
6
|
## [Unreleased]
|
|
@@ -8,6 +8,13 @@ Changes since last non-beta release.
|
|
|
8
8
|
|
|
9
9
|
_Please add entries here for your pull requests that are not yet released._
|
|
10
10
|
|
|
11
|
+
## [v6.5.0] - July 4, 2022
|
|
12
|
+
### Added
|
|
13
|
+
- `append_stylesheet_pack_tag` helper. It helps in configuring stylesheet pack names from the view for a route or partials. It is also required for filesystem-based automated Component Registry API on React on Rails gem. [PR 144](https://github.com/shakacode/shakapacker/pull/144) by [pulkitkkr](https://github.com/pulkitkkr).
|
|
14
|
+
|
|
15
|
+
### Improved
|
|
16
|
+
- Make sure at most one compilation runs at a time [PR 139](https://github.com/shakacode/shakapacker/pull/139) by [artemave](https://github.com/artemave)
|
|
17
|
+
|
|
11
18
|
## [v6.4.1] - June 5, 2022
|
|
12
19
|
### Fixed
|
|
13
20
|
- Restores automatic installation of yarn packages removed in [#131](https://github.com/shakacode/shakapacker/pull/131), with added deprecation notice. [PR 140](https://github.com/shakacode/shakapacker/pull/140) by [tomdracz](https://github.com/tomdracz).
|
|
@@ -145,7 +152,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
|
145
152
|
## v5.4.3 and prior changes from rails/webpacker
|
|
146
153
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
|
147
154
|
|
|
148
|
-
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v6.
|
|
155
|
+
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v6.5.0...master
|
|
156
|
+
[v6.5.0]: https://github.com/shakacode/shakapacker/compare/v6.4.1...v6.5.0
|
|
149
157
|
[v6.4.1]: https://github.com/shakacode/shakapacker/compare/v6.4.0...v6.4.1
|
|
150
158
|
[v6.4.0]: https://github.com/shakacode/shakapacker/compare/v6.3.0...v6.4.0
|
|
151
159
|
[v6.3.0]: https://github.com/shakacode/shakapacker/compare/v6.2.1...v6.3.0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -26,50 +26,60 @@ Discussion forum and Slack to discuss debugging and troubleshooting tips. Please
|
|
|
26
26
|
2. [Slack discussion channel](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE)
|
|
27
27
|
3. [Tweets with tag `#shakapacker`](https://twitter.com/hashtag/shakapacker?src=hashtag_click)
|
|
28
28
|
|
|
29
|
-
[ShakaCode](https://www.shakacode.com) offers support for upgrading from webpacker
|
|
29
|
+
[ShakaCode](https://www.shakacode.com) offers support for upgrading from webpacker and using Shakapacker. If interested, contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com). ShakaCode is [hiring passionate engineers](https://jobs.lever.co/shakacode/3bdbfdb3-4495-4611-a279-01dddb351abe) that love open source.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
33
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
34
34
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
35
35
|
|
|
36
|
-
- [Prerequisites](#prerequisites)
|
|
37
|
-
- [Features](#features)
|
|
38
|
-
|
|
39
|
-
- [Installation](#installation)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- [
|
|
43
|
-
- [Usage](#usage)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- [
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- [
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
36
|
+
- [Prerequisites](#prerequisites)
|
|
37
|
+
- [Features](#features)
|
|
38
|
+
- [Optional support](#optional-support)
|
|
39
|
+
- [Installation](#installation)
|
|
40
|
+
- [Rails v6+](#rails-v6)
|
|
41
|
+
- [Note for Yarn v2 usage](#note-for-yarn-v2-usage)
|
|
42
|
+
- [Concepts](#concepts)
|
|
43
|
+
- [Usage](#usage)
|
|
44
|
+
- [Configuration and Code](#configuration-and-code)
|
|
45
|
+
- [View Helpers](#view-helpers)
|
|
46
|
+
- [View Helpers `javascript_pack_tag` and `stylesheet_pack_tag`](#view-helpers-javascript_pack_tag-and-stylesheet_pack_tag)
|
|
47
|
+
- [View Helper `append_javascript_pack_tag` and `append_stylesheet_pack_tag`](#view-helper-append_javascript_pack_tag-and-append_stylesheet_pack_tag)
|
|
48
|
+
- [View Helper: `asset_pack_path`](#view-helper-asset_pack_path)
|
|
49
|
+
- [View Helper: `image_pack_tag`](#view-helper-image_pack_tag)
|
|
50
|
+
- [View Helper: `favicon_pack_tag`](#view-helper-favicon_pack_tag)
|
|
51
|
+
- [View Helper: `preload_pack_asset`](#view-helper-preload_pack_asset)
|
|
52
|
+
- [Images in Stylesheets](#images-in-stylesheets)
|
|
53
|
+
- [Server-Side Rendering (SSR)](#server-side-rendering-ssr)
|
|
54
|
+
- [Development](#development)
|
|
55
|
+
- [Automatic Webpack Code Building](#automatic-webpack-code-building)
|
|
56
|
+
- [Compiler strategies](#compiler-strategies)
|
|
57
|
+
- [Common Development Commands](#common-development-commands)
|
|
58
|
+
- [Webpack Configuration](#webpack-configuration)
|
|
59
|
+
- [Babel configuration](#babel-configuration)
|
|
60
|
+
- [SWC configuration](#swc-configuration)
|
|
61
|
+
- [esbuild loader configuration](#esbuild-loader-configuration)
|
|
62
|
+
- [Integrations](#integrations)
|
|
63
|
+
- [React](#react)
|
|
64
|
+
- [Typescript](#typescript)
|
|
65
|
+
- [CoffeeScript](#coffeescript)
|
|
66
|
+
- [TypeScript](#typescript)
|
|
67
|
+
- [CSS](#css)
|
|
68
|
+
- [Postcss](#postcss)
|
|
69
|
+
- [Sass](#sass)
|
|
70
|
+
- [Less](#less)
|
|
71
|
+
- [Stylus](#stylus)
|
|
72
|
+
- [Other frameworks](#other-frameworks)
|
|
73
|
+
- [Custom Rails environments](#custom-rails-environments)
|
|
74
|
+
- [Upgrading](#upgrading)
|
|
75
|
+
- [Paths](#paths)
|
|
76
|
+
- [Additional paths](#additional-paths)
|
|
77
|
+
- [Deployment](#deployment)
|
|
78
|
+
- [Example Apps](#example-apps)
|
|
79
|
+
- [Troubleshooting](#troubleshooting)
|
|
80
|
+
- [Contributing](#contributing)
|
|
81
|
+
- [License](#license)
|
|
82
|
+
- [Supporters](#supporters)
|
|
73
83
|
|
|
74
84
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
75
85
|
|
|
@@ -249,37 +259,41 @@ While this also generally applies to `stylesheet_pack_tag`, you may use multiple
|
|
|
249
259
|
<%= stylesheet_pack_tag 'print', media: 'print' %>
|
|
250
260
|
```
|
|
251
261
|
|
|
252
|
-
#### View Helper `append_javascript_pack_tag`
|
|
262
|
+
#### View Helper `append_javascript_pack_tag` and `append_stylesheet_pack_tag`
|
|
253
263
|
|
|
254
|
-
If you need configure your pack names from the view for a route or partials, then you will need some logic to ensure you call the helpers only once with multiple arguments. The new view
|
|
264
|
+
If you need configure your script pack names or stylesheet pack names from the view for a route or partials, then you will need some logic to ensure you call the helpers only once with multiple arguments. The new view helpers, `append_javascript_pack_tag` and `append_stylesheet_pack_tag` can solve this problem. The helper `append_javascript_pack_tag` will queue up script packs when the `javascript_pack_tag` is finally used. Similarly,`append_stylesheet_pack_tag` will queue up style packs when the `stylesheet_pack_tag` is finally used.
|
|
255
265
|
|
|
256
266
|
Main view:
|
|
257
267
|
```erb
|
|
258
268
|
<% append_javascript_pack_tag 'calendar' %>
|
|
269
|
+
<% append_stylesheet_pack_tag 'calendar' %>
|
|
259
270
|
```
|
|
260
271
|
|
|
261
272
|
Some partial:
|
|
262
273
|
```erb
|
|
263
274
|
<% append_javascript_pack_tag 'map' %>
|
|
275
|
+
<% append_stylesheet_pack_tag 'map' %>
|
|
264
276
|
```
|
|
265
277
|
|
|
266
278
|
And the main layout has:
|
|
267
279
|
```erb
|
|
268
280
|
<%= javascript_pack_tag 'application' %>
|
|
281
|
+
<%= stylesheet_pack_tag 'application' %>
|
|
269
282
|
```
|
|
270
283
|
|
|
271
284
|
is the same as using this in the main layout:
|
|
272
285
|
|
|
273
286
|
```erb
|
|
274
287
|
<%= javascript_pack_tag 'calendar', 'map', application' %>
|
|
288
|
+
<%= stylesheet_pack_tag 'calendar', 'map', application' %>
|
|
275
289
|
```
|
|
276
290
|
|
|
277
291
|
However, you typically can't do that in the main layout, as the view and partial codes will depend on the route.
|
|
278
292
|
|
|
279
|
-
Thus, you can distribute the logic of what packs are needed for any route. All the magic of splitting up the code was automatic!
|
|
293
|
+
Thus, you can distribute the logic of what packs are needed for any route. All the magic of splitting up the code and CSS was automatic!
|
|
294
|
+
|
|
295
|
+
**Important:** Both `append_(javascript/stylesheet)_pack_tag` helpers can be used anywhere in your application as long as they are executed BEFORE `(javascript/stylesheet)_pack_tag` respectively. If you attempt to call one of the `append_(javascript/stylesheet)_pack_tag` helpers after the respective `(javascript/stylesheet)_pack_tag`, an error will be raised.
|
|
280
296
|
|
|
281
|
-
**Important:** `append_javascript_pack_tag` can be used anywhere in your application as long as it is executed BEFORE the `javascript_pack_tag`. If you attempt to call `append_javascript_pack_tag` helper after `javascript_pack_tag`, an error will be raised. You should have only a single `javascript_pack_tag` invocation in your page load.
|
|
282
|
-
|
|
283
297
|
The typical issue is that your layout might reference some partials that need to configure packs. A good way to solve this problem is to use `content_for` to ensure that the code to render your partial comes before the call to `javascript_pack_tag`.
|
|
284
298
|
|
|
285
299
|
```erb
|
data/lib/webpacker/compiler.rb
CHANGED
|
@@ -14,19 +14,53 @@ class Webpacker::Compiler
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def compile
|
|
17
|
-
|
|
18
|
-
run_webpack.tap do |success|
|
|
19
|
-
after_compile_hook
|
|
20
|
-
end
|
|
21
|
-
else
|
|
17
|
+
unless stale?
|
|
22
18
|
logger.debug "Everything's up-to-date. Nothing to do"
|
|
19
|
+
return true
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if compiling?
|
|
23
|
+
wait_for_compilation_to_complete
|
|
23
24
|
true
|
|
25
|
+
else
|
|
26
|
+
acquire_ipc_lock do
|
|
27
|
+
run_webpack.tap do |success|
|
|
28
|
+
after_compile_hook
|
|
29
|
+
end
|
|
30
|
+
end
|
|
24
31
|
end
|
|
25
32
|
end
|
|
26
33
|
|
|
27
34
|
private
|
|
28
35
|
attr_reader :webpacker
|
|
29
36
|
|
|
37
|
+
def acquire_ipc_lock
|
|
38
|
+
open_lock_file do |lf|
|
|
39
|
+
lf.flock(File::LOCK_EX)
|
|
40
|
+
yield if block_given?
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def locked?
|
|
45
|
+
open_lock_file do |lf|
|
|
46
|
+
lf.flock(File::LOCK_EX | File::LOCK_NB) != 0
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
alias compiling? locked?
|
|
51
|
+
|
|
52
|
+
def wait_for_compilation_to_complete
|
|
53
|
+
logger.info "Waiting for the compilation to complete..."
|
|
54
|
+
acquire_ipc_lock
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def open_lock_file
|
|
58
|
+
lock_file_name = File.join(Dir.tmpdir, "shakapacker.lock")
|
|
59
|
+
File.open(lock_file_name, File::CREAT) do |lf|
|
|
60
|
+
return yield lf
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
30
64
|
def optionalRubyRunner
|
|
31
65
|
bin_webpack_path = config.root_path.join("bin/webpacker")
|
|
32
66
|
first_line = File.readlines(bin_webpack_path).first.chomp
|
data/lib/webpacker/helper.rb
CHANGED
|
@@ -98,7 +98,7 @@ module Webpacker::Helper
|
|
|
98
98
|
def javascript_pack_tag(*names, defer: true, **options)
|
|
99
99
|
if @javascript_pack_tag_loaded
|
|
100
100
|
raise "To prevent duplicated chunks on the page, you should call javascript_pack_tag only once on the page. " \
|
|
101
|
-
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#
|
|
101
|
+
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#view-helpers-javascript_pack_tag-and-stylesheet_pack_tag for the usage guide"
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
append_javascript_pack_tag(*names, defer: defer)
|
|
@@ -158,13 +158,28 @@ module Webpacker::Helper
|
|
|
158
158
|
def stylesheet_pack_tag(*names, **options)
|
|
159
159
|
return "" if Webpacker.inlining_css?
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
requested_packs = sources_from_manifest_entrypoints(names, type: :stylesheet)
|
|
162
|
+
appended_packs = available_sources_from_manifest_entrypoints(@stylesheet_pack_tag_queue || [], type: :stylesheet)
|
|
163
|
+
|
|
164
|
+
@stylesheet_pack_tag_loaded = true
|
|
165
|
+
|
|
166
|
+
stylesheet_link_tag(*(requested_packs | appended_packs), **options)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def append_stylesheet_pack_tag(*names)
|
|
170
|
+
if @stylesheet_pack_tag_loaded
|
|
171
|
+
raise "You can only call append_stylesheet_pack_tag before stylesheet_pack_tag helper. " \
|
|
172
|
+
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#view-helper-append_javascript_pack_tag-and-append_stylesheet_pack_tag for the usage guide"
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
@stylesheet_pack_tag_queue ||= []
|
|
176
|
+
@stylesheet_pack_tag_queue.concat names
|
|
162
177
|
end
|
|
163
178
|
|
|
164
179
|
def append_javascript_pack_tag(*names, defer: true)
|
|
165
180
|
if @javascript_pack_tag_loaded
|
|
166
181
|
raise "You can only call append_javascript_pack_tag before javascript_pack_tag helper. " \
|
|
167
|
-
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#
|
|
182
|
+
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#view-helper-append_javascript_pack_tag-and-append_stylesheet_pack_tag for the usage guide"
|
|
168
183
|
end
|
|
169
184
|
|
|
170
185
|
hash_key = defer ? :deferred : :non_deferred
|
|
@@ -184,6 +199,10 @@ module Webpacker::Helper
|
|
|
184
199
|
names.map { |name| current_webpacker_instance.manifest.lookup_pack_with_chunks!(name.to_s, type: type) }.flatten.uniq
|
|
185
200
|
end
|
|
186
201
|
|
|
202
|
+
def available_sources_from_manifest_entrypoints(names, type:)
|
|
203
|
+
names.map { |name| current_webpacker_instance.manifest.lookup_pack_with_chunks(name.to_s, type: type) }.flatten.compact.uniq
|
|
204
|
+
end
|
|
205
|
+
|
|
187
206
|
def resolve_path_to_image(name, **options)
|
|
188
207
|
path = name.starts_with?("static/") ? name : "static/#{name}"
|
|
189
208
|
path_to_asset(current_webpacker_instance.manifest.lookup!(path), options)
|
data/lib/webpacker/version.rb
CHANGED
data/package.json
CHANGED
data/rakelib/release.rake
CHANGED
|
@@ -44,6 +44,7 @@ task :create_release, %i[gem_version dry_run] do |_t, args|
|
|
|
44
44
|
# See https://github.com/svenfuchs/gem-release
|
|
45
45
|
Shakapacker::Utils::Misc.sh_in_dir(gem_root, "git pull --rebase")
|
|
46
46
|
Shakapacker::Utils::Misc.sh_in_dir(gem_root, "gem bump --no-commit #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}")
|
|
47
|
+
Shakapacker::Utils::Misc.sh_in_dir(gem_root, "bundle install")
|
|
47
48
|
|
|
48
49
|
# Will bump the yarn version, commit, tag the commit, push to repo, and release on yarn
|
|
49
50
|
release_it_command = +"release-it"
|
data/test/helper_test.rb
CHANGED
|
@@ -133,7 +133,7 @@ class HelperTest < ActionView::TestCase
|
|
|
133
133
|
|
|
134
134
|
assert_equal \
|
|
135
135
|
"You can only call append_javascript_pack_tag before javascript_pack_tag helper. " +
|
|
136
|
-
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#
|
|
136
|
+
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#view-helper-append_javascript_pack_tag-and-append_stylesheet_pack_tag for the usage guide",
|
|
137
137
|
error.message
|
|
138
138
|
end
|
|
139
139
|
|
|
@@ -161,7 +161,7 @@ class HelperTest < ActionView::TestCase
|
|
|
161
161
|
|
|
162
162
|
assert_equal \
|
|
163
163
|
"To prevent duplicated chunks on the page, you should call javascript_pack_tag only once on the page. " +
|
|
164
|
-
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#
|
|
164
|
+
"Please refer to https://github.com/shakacode/shakapacker/blob/master/README.md#view-helpers-javascript_pack_tag-and-stylesheet_pack_tag for the usage guide",
|
|
165
165
|
error.message
|
|
166
166
|
end
|
|
167
167
|
|
|
@@ -204,5 +204,45 @@ class HelperTest < ActionView::TestCase
|
|
|
204
204
|
assert_equal \
|
|
205
205
|
hello_stimulus_stylesheet_chunks.map { |chunk| stylesheet_link_tag(chunk) }.join("\n"),
|
|
206
206
|
stimulus_style
|
|
207
|
+
|
|
208
|
+
assert_nothing_raised do
|
|
209
|
+
stylesheet_pack_tag(:application)
|
|
210
|
+
stylesheet_pack_tag(:hello_stimulus)
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def test_stylesheet_pack_with_append
|
|
215
|
+
append_stylesheet_pack_tag(:hello_stimulus)
|
|
216
|
+
|
|
217
|
+
assert_equal \
|
|
218
|
+
(application_stylesheet_chunks + hello_stimulus_stylesheet_chunks).uniq.map { |chunk| stylesheet_link_tag(chunk) }.join("\n"),
|
|
219
|
+
stylesheet_pack_tag(:application)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def test_stylesheet_pack_with_duplicate_append
|
|
223
|
+
append_stylesheet_pack_tag(:hello_stimulus)
|
|
224
|
+
append_stylesheet_pack_tag(:application)
|
|
225
|
+
|
|
226
|
+
assert_equal \
|
|
227
|
+
(application_stylesheet_chunks + hello_stimulus_stylesheet_chunks).uniq.map { |chunk| stylesheet_link_tag(chunk) }.join("\n"),
|
|
228
|
+
stylesheet_pack_tag(:application)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def test_multiple_stylesheet_pack_with_different_media_attr
|
|
232
|
+
app_style = stylesheet_pack_tag(:application)
|
|
233
|
+
app_style_with_media = stylesheet_pack_tag(:application, media: "print")
|
|
234
|
+
hello_stimulus_style_with_media = stylesheet_pack_tag(:hello_stimulus, media: "all")
|
|
235
|
+
|
|
236
|
+
assert_equal \
|
|
237
|
+
application_stylesheet_chunks.map { |chunk| stylesheet_link_tag(chunk) }.join("\n"),
|
|
238
|
+
app_style
|
|
239
|
+
|
|
240
|
+
assert_equal \
|
|
241
|
+
application_stylesheet_chunks.map { |chunk| stylesheet_link_tag(chunk, media: "print") }.join("\n"),
|
|
242
|
+
app_style_with_media
|
|
243
|
+
|
|
244
|
+
assert_equal \
|
|
245
|
+
hello_stimulus_stylesheet_chunks.map { |chunk| stylesheet_link_tag(chunk, media: "all") }.join("\n"),
|
|
246
|
+
hello_stimulus_style_with_media
|
|
207
247
|
end
|
|
208
248
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shakapacker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2022-
|
|
13
|
+
date: 2022-07-04 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activesupport
|
|
@@ -303,7 +303,7 @@ homepage: https://github.com/shakacode/shakapacker
|
|
|
303
303
|
licenses:
|
|
304
304
|
- MIT
|
|
305
305
|
metadata:
|
|
306
|
-
source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.
|
|
306
|
+
source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.5.0
|
|
307
307
|
post_install_message:
|
|
308
308
|
rdoc_options: []
|
|
309
309
|
require_paths:
|