webpacker 4.0.0.rc.3 → 4.0.0.rc.4

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: 7b4e8fa7b4d57022ab1e34dd1e5ea82e7aeabda41f11c158bdb8989c05fe1c0e
4
- data.tar.gz: 0c9f6d2906a79d379d7f3f5fb097b338e740a39452d0bc2ac33dd3bd30eb3895
3
+ metadata.gz: 8e59a8e39d5e62949cee0e64781d86635317e7cd3e0d53309c85f3dfafd4f906
4
+ data.tar.gz: b972766f60e694bf25a2811b2f32073fb70d41d3f712ba4a8f9b7569644c9f5a
5
5
  SHA512:
6
- metadata.gz: ee59500d81e622c90f0feddd8c026126eb1f1e14f0d37af880d826af56b60f74b5b3ee380397c36bbbd157de059e48d9f2552e6d72dcd295d310ee7ebaa01a42
7
- data.tar.gz: 0fc59e37a1d3fa940ed3b9e5e8e15667c771a0571029142d507f5d0d3577fa70eb670115ccc6ea0540c0b2afa35c9c501049d204701a2a0389a9499e29f2699d
6
+ metadata.gz: f1a7e76bc860182c762823d8529b90da20af31e478769d1cead561306c041e37f7cfb14a860a97d017916bc3bb00708f0286ec4fef77e7fc946c20900b72517c
7
+ data.tar.gz: 382b1af6fca579019a3280df5dbe1723d7cddd239be02c8910a9b3e6525bc2587c2a7ce3272f335f34f3666b1ea43469cc2cbc3d3a9091ca13660823e8d3c6eb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  **Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
2
2
 
3
+ ## [4.0.0.rc.4] - 2019-01-21
4
+
5
+ ### Added
6
+ - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
7
+ loading stylesheets chunks.
8
+
9
+ ```erb
10
+ <%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
11
+
12
+ <link rel="stylesheet" media="screen" href="/packs/3-8c7ce31a.chunk.css" />
13
+ <link rel="stylesheet" media="screen" href="/packs/calendar-8c7ce31a.chunk.css" />
14
+ <link rel="stylesheet" media="screen" href="/packs/map-8c7ce31a.chunk.css" />
15
+ ```
16
+
17
+ **Important:** Pass all your pack names when using `stylesheet_packs_with_chunks_tag`
18
+ helper otherwise you will get duplicated chunks on the page.
19
+
20
+ ```erb
21
+ <%# DO %>
22
+ # <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %>
23
+ <%# DON'T %>
24
+ # <%= stylesheet_packs_with_chunks_tag 'calendar' %>
25
+ # <%= stylesheet_packs_with_chunks_tag 'map' %>
26
+ ```
27
+
28
+
3
29
  ## [4.0.0.rc.3] - 2019-01-17
4
30
 
5
31
  ### Fixed
data/Gemfile.lock CHANGED
@@ -14,7 +14,7 @@ GIT
14
14
  PATH
15
15
  remote: .
16
16
  specs:
17
- webpacker (4.0.0.rc.3)
17
+ webpacker (4.0.0.rc.4)
18
18
  activesupport (>= 4.2)
19
19
  rack-proxy (>= 0.6.1)
20
20
  railties (>= 4.2)
@@ -62,7 +62,7 @@ module Webpacker::Helper
62
62
  javascript_include_tag(*sources_from_manifest_entries(names, type: :javascript), **options)
63
63
  end
64
64
 
65
- # Creates script tags that references the chunks from entrypoints when using split chunks API,
65
+ # Creates script tags that references the js chunks from entrypoints when using split chunks API,
66
66
  # as compiled by webpack per the entries list in config/webpack/shared.js.
67
67
  # By default, this list is auto-generated to match everything in
68
68
  # app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
@@ -70,11 +70,11 @@ module Webpacker::Helper
70
70
  # Example:
71
71
  #
72
72
  # <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %> # =>
73
- # <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
74
- # <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
75
- # <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
76
- # <script src="/packs/map~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
77
- # <script src="/packs/map-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
73
+ # <script src="/packs/vendor-16838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
74
+ # <script src="/packs/calendar~runtime-16838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
75
+ # <script src="/packs/calendar-1016838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
76
+ # <script src="/packs/map~runtime-16838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
77
+ # <script src="/packs/map-16838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
78
78
  # DO:
79
79
  # <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
80
80
  # DON'T:
@@ -106,6 +106,28 @@ module Webpacker::Helper
106
106
  end
107
107
  end
108
108
 
109
+ # Creates link tags that references the css chunks from entrypoints when using split chunks API,
110
+ # as compiled by webpack per the entries list in config/webpack/shared.js.
111
+ # By default, this list is auto-generated to match everything in
112
+ # app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
113
+ # See: https://webpack.js.org/plugins/split-chunks-plugin/
114
+ # Example:
115
+ #
116
+ # <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %> # =>
117
+ # <link rel="stylesheet" media="screen" href="/packs/3-8c7ce31a.chunk.css" />
118
+ # <link rel="stylesheet" media="screen" href="/packs/calendar-8c7ce31a.chunk.css" />
119
+ # <link rel="stylesheet" media="screen" href="/packs/map-8c7ce31a.chunk.css" />
120
+ # DO:
121
+ # <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %>
122
+ # DON'T:
123
+ # <%= stylesheet_packs_with_chunks_tag 'calendar' %>
124
+ # <%= stylesheet_packs_with_chunks_tag 'map' %>
125
+ def stylesheet_packs_with_chunks_tag(*names, **options)
126
+ if current_webpacker_instance.config.extract_css?
127
+ stylesheet_link_tag(*sources_from_manifest_entrypoints(names, type: :stylesheet), **options)
128
+ end
129
+ end
130
+
109
131
  private
110
132
  def stylesheet?(name)
111
133
  File.extname(name) == ".css"
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "4.0.0.rc.3".freeze
3
+ VERSION = "4.0.0.rc.4".freeze
4
4
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rails/webpacker",
3
- "version": "4.0.0-rc.3",
3
+ "version": "4.0.0-rc.4",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "main": "package/index.js",
6
6
  "files": [
data/test/helper_test.rb CHANGED
@@ -67,6 +67,14 @@ class HelperTest < ActionView::TestCase
67
67
  javascript_packs_with_chunks_tag("application")
68
68
  end
69
69
 
70
+ def test_stylesheet_pack_tag_split_chunks
71
+ assert_equal \
72
+ %(<link rel="stylesheet" media="screen" href="/packs/1-c20632e7baf2c81200d3.chunk.css" />\n) +
73
+ %(<link rel="stylesheet" media="screen" href="/packs/application-k344a6d59eef8632c9d1.chunk.css" />\n) +
74
+ %(<link rel="stylesheet" media="screen" href="/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css" />),
75
+ stylesheet_packs_with_chunks_tag("application", "hello_stimulus")
76
+ end
77
+
70
78
  def test_stylesheet_pack_tag
71
79
  assert_equal \
72
80
  %(<link rel="stylesheet" media="screen" href="/packs/bootstrap-c38deda30895059837cf.css" />),
@@ -10,6 +10,16 @@
10
10
  "/packs/vendors~application~bootstrap-c20632e7baf2c81200d3.chunk.js",
11
11
  "/packs/vendors~application-e55f2aae30c07fb6d82a.chunk.js",
12
12
  "/packs/application-k344a6d59eef8632c9d1.js"
13
+ ],
14
+ "css": [
15
+ "/packs/1-c20632e7baf2c81200d3.chunk.css",
16
+ "/packs/application-k344a6d59eef8632c9d1.chunk.css"
17
+ ]
18
+ },
19
+ "hello_stimulus": {
20
+ "css": [
21
+ "/packs/1-c20632e7baf2c81200d3.chunk.css",
22
+ "/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css"
13
23
  ]
14
24
  }
15
25
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc.3
4
+ version: 4.0.0.rc.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-17 00:00:00.000000000 Z
12
+ date: 2019-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -252,8 +252,8 @@ homepage: https://github.com/rails/webpacker
252
252
  licenses:
253
253
  - MIT
254
254
  metadata:
255
- source_code_uri: https://github.com/rails/webpacker/tree/v4.0.0.rc.3
256
- changelog_uri: https://github.com/rails/webpacker/blob/v4.0.0.rc.3/CHANGELOG.md
255
+ source_code_uri: https://github.com/rails/webpacker/tree/v4.0.0.rc.4
256
+ changelog_uri: https://github.com/rails/webpacker/blob/v4.0.0.rc.4/CHANGELOG.md
257
257
  post_install_message:
258
258
  rdoc_options: []
259
259
  require_paths: