webpacker 6.0.0.beta.7 → 6.0.0.pre.1
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/.github/workflows/jest.yml +1 -1
- data/.github/workflows/js-lint.yml +1 -1
- data/.github/workflows/ruby.yml +6 -9
- data/.rubocop.yml +0 -105
- data/CHANGELOG.md +6 -22
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +90 -93
- data/README.md +110 -308
- data/docs/assets.md +135 -0
- data/docs/cloud9.md +310 -0
- data/docs/css.md +303 -0
- data/docs/deployment.md +29 -9
- data/docs/docker.md +68 -0
- data/docs/engines.md +213 -0
- data/docs/env.md +68 -0
- data/docs/es6.md +72 -0
- data/docs/folder-structure.md +66 -0
- data/docs/integrations.md +220 -0
- data/docs/misc.md +23 -0
- data/docs/props.md +187 -0
- data/docs/react.md +183 -0
- data/docs/target.md +22 -0
- data/docs/testing.md +147 -0
- data/docs/troubleshooting.md +3 -5
- data/docs/typescript.md +190 -0
- data/docs/v4-upgrade.md +142 -0
- data/docs/webpack-dev-server.md +94 -0
- data/docs/webpack.md +315 -0
- data/docs/yarn.md +23 -0
- data/lib/install/config/webpacker.yml +3 -5
- data/lib/install/examples/vue3/app.vue +27 -0
- data/lib/install/examples/vue3/hello_vue.js +15 -0
- data/lib/install/javascript/packs/application.css +9 -0
- data/lib/install/{packs/entrypoints → javascript/packs}/application.js +2 -4
- data/lib/install/template.rb +9 -16
- data/lib/tasks/webpacker/binstubs.rake +2 -2
- data/lib/tasks/webpacker/check_node.rake +0 -1
- data/lib/tasks/webpacker/check_yarn.rake +0 -1
- data/lib/tasks/webpacker/install.rake +2 -2
- data/lib/webpacker/commands.rb +1 -2
- data/lib/webpacker/compiler.rb +3 -9
- data/lib/webpacker/configuration.rb +4 -4
- data/lib/webpacker/dev_server_runner.rb +0 -2
- data/lib/webpacker/helper.rb +43 -13
- data/lib/webpacker/manifest.rb +1 -1
- data/lib/webpacker/version.rb +1 -1
- data/lib/webpacker/webpack_runner.rb +0 -1
- data/package.json +1 -1
- data/package/__tests__/development.js +1 -2
- data/package/babel/preset-react.js +62 -0
- data/package/babel/preset.js +13 -24
- data/package/environments/__tests__/base.js +5 -5
- data/package/environments/base.js +20 -15
- data/package/environments/development.js +0 -1
- data/package/environments/production.js +30 -28
- data/package/index.js +2 -7
- data/package/rules/babel.js +1 -1
- data/package/rules/coffee.js +5 -5
- data/package/rules/erb.js +3 -5
- data/package/rules/file.js +3 -5
- data/package/rules/index.js +17 -9
- data/package/rules/less.js +10 -14
- data/package/rules/sass.js +9 -13
- data/package/rules/svg.js +23 -0
- data/package/utils/get_style_rule.js +31 -27
- data/package/utils/helpers.js +0 -25
- data/test/configuration_test.rb +2 -2
- data/test/dev_server_runner_test.rb +2 -10
- data/test/helper_test.rb +39 -33
- data/test/manifest_test.rb +0 -8
- data/test/mounted_app/test/dummy/config/webpacker.yml +3 -3
- data/test/test_app/app/{packs/entrypoints → javascript/packs}/application.js +1 -1
- data/test/test_app/app/{packs/entrypoints → javascript/packs}/multi_entry.css +0 -0
- data/test/test_app/app/{packs/entrypoints → javascript/packs}/multi_entry.js +0 -0
- data/test/test_app/config/webpacker.yml +3 -3
- data/test/test_app/public/packs/manifest.json +0 -7
- metadata +36 -18
- data/config/README.md +0 -3
- data/config/webpacker.yml +0 -1
- data/docs/v6_upgrade.md +0 -86
- data/package/__tests__/index.js +0 -9
- data/package/rules/raw.js +0 -5
- data/package/rules/stylus.js +0 -26
data/docs/yarn.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Yarn
|
2
|
+
|
3
|
+
Webpacker by default uses `yarn` as a package manager for `node_modules`
|
4
|
+
|
5
|
+
|
6
|
+
## Add a new npm module
|
7
|
+
|
8
|
+
To add any new JS module you can use `yarn`:
|
9
|
+
|
10
|
+
```bash
|
11
|
+
yarn add bootstrap material-ui
|
12
|
+
```
|
13
|
+
|
14
|
+
## Add an npm module to `devDependencies`
|
15
|
+
To add a new JS module that will only be available to local development:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
yarn add --dev browser-sync
|
19
|
+
```
|
20
|
+
|
21
|
+
Be careful not to add any build or app related JS modules in this fashion. Adding JS modules to `devDependencies` [will block them from being installed in **any** production environment](https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-production-true-false).
|
22
|
+
|
23
|
+
Docs from JS modules may instruct you to use `--dev` or `devDependencies`, but this is generally under the assumption that you are using a `node.js` workflow.
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
2
2
|
|
3
3
|
default: &default
|
4
|
-
source_path: app/
|
5
|
-
source_entry_path:
|
4
|
+
source_path: app/javascript
|
5
|
+
source_entry_path: packs
|
6
6
|
public_root_path: public
|
7
7
|
public_output_path: packs
|
8
8
|
cache_path: tmp/cache/webpacker
|
9
9
|
webpack_compile_output: true
|
10
10
|
|
11
|
-
# Additional paths webpack should
|
11
|
+
# Additional paths webpack should lookup modules
|
12
12
|
# ['app/assets', 'engine/foo/app/assets']
|
13
13
|
additional_paths: []
|
14
14
|
|
@@ -25,8 +25,6 @@ development:
|
|
25
25
|
host: localhost
|
26
26
|
port: 3035
|
27
27
|
public: localhost:3035
|
28
|
-
# Inject browserside javascript that required by both HMR and Live(full) reload
|
29
|
-
inject_client: true
|
30
28
|
# Hot Module Replacement updates modules while the application is running without a full reload
|
31
29
|
hmr: false
|
32
30
|
# Inline should be set to true if using HMR; it inserts a script to take care of live reloading
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<template>
|
2
|
+
<p>
|
3
|
+
{{ message }}
|
4
|
+
</p>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import { ref } from 'vue'
|
9
|
+
|
10
|
+
export default {
|
11
|
+
name: 'HelloWorld',
|
12
|
+
setup() {
|
13
|
+
const message = ref('Hello World')
|
14
|
+
|
15
|
+
return {
|
16
|
+
message
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<style scoped>
|
23
|
+
p {
|
24
|
+
font-size: 2em;
|
25
|
+
text-align: center;
|
26
|
+
}
|
27
|
+
</style>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/* eslint no-console: 0 */
|
2
|
+
// Run this example by adding <%= javascript_pack_tag 'hello_vue' %> (and
|
3
|
+
// <%= stylesheet_pack_tag 'hello_vue' %> if you have styles in your component)
|
4
|
+
// to the head of your layout file,
|
5
|
+
// like app/views/layouts/application.html.erb.
|
6
|
+
// Create a div container with the id 'vue-app' <div id='vue-app'></div>
|
7
|
+
// It renders <p>Hello Vue</p> into it.
|
8
|
+
|
9
|
+
import { createApp } from "vue";
|
10
|
+
import App from "../app.vue";
|
11
|
+
|
12
|
+
document.addEventListener("DOMContentLoaded", () => {
|
13
|
+
const app = createApp(App);
|
14
|
+
app.mount("#vue-app");
|
15
|
+
});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/*
|
2
|
+
Any CSS added to this file or imported from this file, e.g. `@import '../stylesheets/my-css.css'`,
|
3
|
+
will be included in the "application" pack. Any CSS imported from application.js or as part of the
|
4
|
+
application.js dependency graph, e.g. `import '../stylesheets/my-css.css'` will also be included
|
5
|
+
in the "application" pack.
|
6
|
+
|
7
|
+
To reference this file, add <%= stylesheet_pack_tag 'application' %> to the appropriate
|
8
|
+
layout file, like app/views/layouts/application.html.erb
|
9
|
+
*/
|
@@ -1,12 +1,13 @@
|
|
1
1
|
/* eslint no-console:0 */
|
2
2
|
// This file is automatically compiled by Webpack, along with any other files
|
3
3
|
// present in this directory. You're encouraged to place your actual application logic in
|
4
|
-
// a relevant structure within app/
|
4
|
+
// a relevant structure within app/javascript and only use these pack files to reference
|
5
5
|
// that code so it'll be compiled.
|
6
6
|
//
|
7
7
|
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
|
8
8
|
// layout file, like app/views/layouts/application.html.erb
|
9
9
|
|
10
|
+
|
10
11
|
// Uncomment to copy all static images under ../images to the output folder and reference
|
11
12
|
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
12
13
|
// or the `imagePath` JavaScript helper below.
|
@@ -14,7 +15,4 @@
|
|
14
15
|
// const images = require.context('../images', true)
|
15
16
|
// const imagePath = (name) => images(name, true)
|
16
17
|
|
17
|
-
import 'core-js/stable'
|
18
|
-
import 'regenerator-runtime/runtime'
|
19
|
-
|
20
18
|
console.log('Hello World from Webpacker')
|
data/lib/install/template.rb
CHANGED
@@ -5,10 +5,10 @@ say "Copying webpack core config"
|
|
5
5
|
directory "#{__dir__}/config/webpack", "config/webpack"
|
6
6
|
|
7
7
|
if Dir.exists?(Webpacker.config.source_path)
|
8
|
-
say "The
|
8
|
+
say "The JavaScript app source directory already exists"
|
9
9
|
else
|
10
|
-
say "Creating
|
11
|
-
directory "#{__dir__}/
|
10
|
+
say "Creating JavaScript app source directory"
|
11
|
+
directory "#{__dir__}/javascript", Webpacker.config.source_path
|
12
12
|
end
|
13
13
|
|
14
14
|
apply "#{__dir__}/binstubs.rb"
|
@@ -26,15 +26,13 @@ if File.exists?(git_ignore_path)
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
results = []
|
30
|
-
|
31
29
|
Dir.chdir(Rails.root) do
|
32
|
-
if Webpacker::VERSION
|
30
|
+
if Webpacker::VERSION =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
|
33
31
|
say "Installing all JavaScript dependencies [#{Webpacker::VERSION}]"
|
34
|
-
|
32
|
+
run "yarn add @rails/webpacker@#{Webpacker::VERSION}"
|
35
33
|
else
|
36
34
|
say "Installing all JavaScript dependencies [from prerelease rails/webpacker]"
|
37
|
-
|
35
|
+
run "yarn add @rails/webpacker@next"
|
38
36
|
end
|
39
37
|
|
40
38
|
package_json = File.read("#{__dir__}/../../package.json")
|
@@ -43,10 +41,10 @@ Dir.chdir(Rails.root) do
|
|
43
41
|
|
44
42
|
# needed for experimental Yarn 2 support and should not harm Yarn 1
|
45
43
|
say "Installing webpack and webpack-cli as direct dependencies"
|
46
|
-
|
44
|
+
run "yarn add webpack@#{webpack_version} webpack-cli@#{webpack_cli_version}"
|
47
45
|
|
48
46
|
say "Installing dev server for live reloading"
|
49
|
-
|
47
|
+
run "yarn add --dev webpack-dev-server @webpack-cli/serve"
|
50
48
|
end
|
51
49
|
|
52
50
|
insert_into_file Rails.root.join("package.json").to_s, before: /\n}\n*$/ do
|
@@ -68,9 +66,4 @@ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
|
68
66
|
say "policy.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?", :yellow
|
69
67
|
end
|
70
68
|
|
71
|
-
|
72
|
-
say "Webpacker successfully installed 🎉 🍰", :green
|
73
|
-
else
|
74
|
-
say "Webpacker installation failed 😭 See above for details.", :red
|
75
|
-
exit 1
|
76
|
-
end
|
69
|
+
say "Webpacker successfully installed 🎉 🍰", :green
|
@@ -7,9 +7,9 @@ namespace :webpacker do
|
|
7
7
|
prefix = task.name.split(/#|webpacker:binstubs/).first
|
8
8
|
|
9
9
|
if Rails::VERSION::MAJOR >= 5
|
10
|
-
exec "#{RbConfig.ruby} #{bin_path}/rails #{prefix}app:template LOCATION
|
10
|
+
exec "#{RbConfig.ruby} #{bin_path}/rails #{prefix}app:template LOCATION=#{binstubs_template_path}"
|
11
11
|
else
|
12
|
-
exec "#{RbConfig.ruby} #{bin_path}/rake #{prefix}rails:template LOCATION
|
12
|
+
exec "#{RbConfig.ruby} #{bin_path}/rake #{prefix}rails:template LOCATION=#{binstubs_template_path}"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -7,9 +7,9 @@ namespace :webpacker do
|
|
7
7
|
prefix = task.name.split(/#|webpacker:install/).first
|
8
8
|
|
9
9
|
if Rails::VERSION::MAJOR >= 5
|
10
|
-
exec "#{RbConfig.ruby} #{bin_path}/rails #{prefix}app:template LOCATION
|
10
|
+
exec "#{RbConfig.ruby} #{bin_path}/rails #{prefix}app:template LOCATION=#{install_template_path}"
|
11
11
|
else
|
12
|
-
exec "#{RbConfig.ruby} #{bin_path}/rake #{prefix}rails:template LOCATION
|
12
|
+
exec "#{RbConfig.ruby} #{bin_path}/rake #{prefix}rails:template LOCATION=#{install_template_path}"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/webpacker/commands.rb
CHANGED
@@ -64,8 +64,7 @@ class Webpacker::Commands
|
|
64
64
|
|
65
65
|
def current_version
|
66
66
|
packs = manifest.refresh.values.map do |value|
|
67
|
-
|
68
|
-
next unless value.is_a?(String)
|
67
|
+
next if value.is_a?(Hash)
|
69
68
|
|
70
69
|
File.join(config.root_path, "public", "#{value}*")
|
71
70
|
end.compact
|
data/lib/webpacker/compiler.rb
CHANGED
@@ -28,14 +28,14 @@ class Webpacker::Compiler
|
|
28
28
|
record_compilation_digest
|
29
29
|
end
|
30
30
|
else
|
31
|
-
logger.
|
31
|
+
logger.info "Everything's up-to-date. Nothing to do"
|
32
32
|
true
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
# Returns true if all the compiled packs are up to date with the underlying asset files.
|
37
37
|
def fresh?
|
38
|
-
last_compilation_digest
|
38
|
+
watched_files_digest == last_compilation_digest
|
39
39
|
end
|
40
40
|
|
41
41
|
# Returns true if the compiled packs are out of date with the underlying asset files.
|
@@ -65,18 +65,12 @@ class Webpacker::Compiler
|
|
65
65
|
compilation_digest_path.write(watched_files_digest)
|
66
66
|
end
|
67
67
|
|
68
|
-
def optionalRubyRunner
|
69
|
-
bin_webpack_path = config.root_path.join("bin/webpack")
|
70
|
-
first_line = File.readlines(bin_webpack_path).first.chomp
|
71
|
-
/ruby/.match?(first_line) ? RbConfig.ruby : ""
|
72
|
-
end
|
73
|
-
|
74
68
|
def run_webpack
|
75
69
|
logger.info "Compiling..."
|
76
70
|
|
77
71
|
stdout, stderr, status = Open3.capture3(
|
78
72
|
webpack_env,
|
79
|
-
"#{
|
73
|
+
"#{RbConfig.ruby} ./bin/webpack",
|
80
74
|
chdir: File.expand_path(config.root_path)
|
81
75
|
)
|
82
76
|
|
@@ -63,11 +63,11 @@ class Webpacker::Configuration
|
|
63
63
|
fetch(:webpack_compile_output)
|
64
64
|
end
|
65
65
|
|
66
|
-
def fetch(key)
|
67
|
-
data.fetch(key, defaults[key])
|
68
|
-
end
|
69
|
-
|
70
66
|
private
|
67
|
+
def fetch(key)
|
68
|
+
data.fetch(key, defaults[key])
|
69
|
+
end
|
70
|
+
|
71
71
|
def data
|
72
72
|
@data ||= load
|
73
73
|
end
|
@@ -64,7 +64,6 @@ module Webpacker
|
|
64
64
|
def execute_cmd
|
65
65
|
env = Webpacker::Compiler.env
|
66
66
|
env["WEBPACKER_CONFIG"] = @webpacker_config
|
67
|
-
env["WEBPACK_DEV_SERVER"] = "true"
|
68
67
|
|
69
68
|
cmd = if node_modules_bin_exist?
|
70
69
|
["#{@node_modules_bin_path}/webpack", "serve"]
|
@@ -74,7 +73,6 @@ module Webpacker
|
|
74
73
|
|
75
74
|
if @argv.include?("--debug-webpacker")
|
76
75
|
cmd = [ "node", "--inspect-brk"] + cmd
|
77
|
-
@argv.delete "--debug-webpacker"
|
78
76
|
end
|
79
77
|
|
80
78
|
cmd += ["--config", @webpack_config]
|
data/lib/webpacker/helper.rb
CHANGED
@@ -72,15 +72,27 @@ module Webpacker::Helper
|
|
72
72
|
favicon_link_tag(resolve_path_to_image(name), options)
|
73
73
|
end
|
74
74
|
|
75
|
+
# Creates a script tag that references the named pack file, as compiled by webpack per the entries list
|
76
|
+
# in package/environments/base.js. By default, this list is auto-generated to match everything in
|
77
|
+
# app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
|
78
|
+
#
|
79
|
+
# Example:
|
80
|
+
#
|
81
|
+
# <%= javascript_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
|
82
|
+
# <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
|
83
|
+
def javascript_pack_tag(*names, **options)
|
84
|
+
javascript_include_tag(*sources_from_manifest_entries(names, type: :javascript), **options)
|
85
|
+
end
|
86
|
+
|
75
87
|
# Creates script tags that reference the js chunks from entrypoints when using split chunks API,
|
76
88
|
# as compiled by webpack per the entries list in package/environments/base.js.
|
77
89
|
# By default, this list is auto-generated to match everything in
|
78
|
-
# app/packs
|
90
|
+
# app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
|
79
91
|
# See: https://webpack.js.org/plugins/split-chunks-plugin/
|
80
92
|
#
|
81
93
|
# Example:
|
82
94
|
#
|
83
|
-
# <%=
|
95
|
+
# <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %> # =>
|
84
96
|
# <script src="/packs/vendor-16838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
|
85
97
|
# <script src="/packs/calendar~runtime-16838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
|
86
98
|
# <script src="/packs/calendar-1016838bab065ae1e314.chunk.js" data-turbolinks-track="reload"></script>
|
@@ -89,13 +101,13 @@ module Webpacker::Helper
|
|
89
101
|
#
|
90
102
|
# DO:
|
91
103
|
#
|
92
|
-
# <%=
|
104
|
+
# <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
|
93
105
|
#
|
94
106
|
# DON'T:
|
95
107
|
#
|
96
|
-
# <%=
|
97
|
-
# <%=
|
98
|
-
def
|
108
|
+
# <%= javascript_packs_with_chunks_tag 'calendar' %>
|
109
|
+
# <%= javascript_packs_with_chunks_tag 'map' %>
|
110
|
+
def javascript_packs_with_chunks_tag(*names, **options)
|
99
111
|
javascript_include_tag(*sources_from_manifest_entrypoints(names, type: :javascript), **options)
|
100
112
|
end
|
101
113
|
|
@@ -115,35 +127,53 @@ module Webpacker::Helper
|
|
115
127
|
end
|
116
128
|
end
|
117
129
|
|
130
|
+
# Creates a link tag that references the named pack file, as compiled by webpack per the entries list
|
131
|
+
# in package/environments/base.js. By default, this list is auto-generated to match everything in
|
132
|
+
# app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
|
133
|
+
#
|
134
|
+
# Note: If the development server is running and hot module replacement is active, this will return nothing.
|
135
|
+
# In that setup you need to configure your styles to be inlined in your JavaScript for hot reloading.
|
136
|
+
#
|
137
|
+
# Examples:
|
138
|
+
#
|
139
|
+
# <%= stylesheet_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
|
140
|
+
# <link rel="stylesheet" media="screen" href="/packs/calendar-1016838bab065ae1e122.css" data-turbolinks-track="reload" />
|
141
|
+
def stylesheet_pack_tag(*names, **options)
|
142
|
+
stylesheet_link_tag(*sources_from_manifest_entries(names, type: :stylesheet), **options)
|
143
|
+
end
|
144
|
+
|
118
145
|
# Creates link tags that reference the css chunks from entrypoints when using split chunks API,
|
119
146
|
# as compiled by webpack per the entries list in package/environments/base.js.
|
120
147
|
# By default, this list is auto-generated to match everything in
|
121
|
-
# app/packs
|
148
|
+
# app/javascript/packs/*.js and all the dependent chunks. In production mode, the digested reference is automatically looked up.
|
122
149
|
# See: https://webpack.js.org/plugins/split-chunks-plugin/
|
123
150
|
#
|
124
151
|
# Examples:
|
125
152
|
#
|
126
|
-
# <%=
|
153
|
+
# <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %> # =>
|
127
154
|
# <link rel="stylesheet" media="screen" href="/packs/3-8c7ce31a.chunk.css" />
|
128
155
|
# <link rel="stylesheet" media="screen" href="/packs/calendar-8c7ce31a.chunk.css" />
|
129
156
|
# <link rel="stylesheet" media="screen" href="/packs/map-8c7ce31a.chunk.css" />
|
130
157
|
#
|
131
158
|
# DO:
|
132
159
|
#
|
133
|
-
# <%=
|
160
|
+
# <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %>
|
134
161
|
#
|
135
162
|
# DON'T:
|
136
163
|
#
|
137
|
-
# <%=
|
138
|
-
# <%=
|
139
|
-
def
|
164
|
+
# <%= stylesheet_packs_with_chunks_tag 'calendar' %>
|
165
|
+
# <%= stylesheet_packs_with_chunks_tag 'map' %>
|
166
|
+
def stylesheet_packs_with_chunks_tag(*names, **options)
|
140
167
|
stylesheet_link_tag(*sources_from_manifest_entrypoints(names, type: :stylesheet), **options)
|
141
168
|
end
|
142
169
|
|
143
170
|
private
|
171
|
+
def sources_from_manifest_entries(names, type:)
|
172
|
+
names.map { |name| current_webpacker_instance.manifest.lookup!(name, type: type) }.flatten
|
173
|
+
end
|
144
174
|
|
145
175
|
def sources_from_manifest_entrypoints(names, type:)
|
146
|
-
names.map { |name| current_webpacker_instance.manifest.lookup_pack_with_chunks!(name
|
176
|
+
names.map { |name| current_webpacker_instance.manifest.lookup_pack_with_chunks!(name, type: type) }.flatten.uniq
|
147
177
|
end
|
148
178
|
|
149
179
|
def resolve_path_to_image(name, **options)
|
data/lib/webpacker/manifest.rb
CHANGED
@@ -92,7 +92,7 @@ class Webpacker::Manifest
|
|
92
92
|
# When the user provides a name with a file extension, we want to try to strip it off.
|
93
93
|
def manifest_name(name, pack_type)
|
94
94
|
return name if File.extname(name.to_s).empty?
|
95
|
-
File.basename(name,
|
95
|
+
File.basename(name, pack_type)
|
96
96
|
end
|
97
97
|
|
98
98
|
def manifest_type(pack_type)
|
data/lib/webpacker/version.rb
CHANGED