Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
dd75c337
Commit
dd75c337
authored
Feb 01, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update webpack helper to automatically include route-based entry points
parent
90012481
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
app/helpers/webpack_helper.rb
app/helpers/webpack_helper.rb
+18
-0
app/views/layouts/_head.html.haml
app/views/layouts/_head.html.haml
+1
-0
No files found.
app/helpers/webpack_helper.rb
View file @
dd75c337
...
@@ -5,6 +5,24 @@ module WebpackHelper
...
@@ -5,6 +5,24 @@ module WebpackHelper
javascript_include_tag
(
*
gitlab_webpack_asset_paths
(
bundle
,
force_same_domain:
force_same_domain
))
javascript_include_tag
(
*
gitlab_webpack_asset_paths
(
bundle
,
force_same_domain:
force_same_domain
))
end
end
def
webpack_controller_bundle_tags
bundles
=
[]
segments
=
[
*
controller
.
controller_path
.
split
(
'/'
),
controller
.
action_name
].
compact
until
segments
.
empty?
begin
asset_paths
=
gitlab_webpack_asset_paths
(
"pages.
#{
segments
.
join
(
'.'
)
}
"
,
extension:
'js'
)
bundles
.
unshift
(
*
asset_paths
)
rescue
Webpack
::
Rails
::
Manifest
::
EntryPointMissingError
# no bundle exists for this path
end
segments
.
pop
end
javascript_include_tag
(
*
bundles
)
end
# override webpack-rails gem helper until changes can make it upstream
# override webpack-rails gem helper until changes can make it upstream
def
gitlab_webpack_asset_paths
(
source
,
extension:
nil
,
force_same_domain:
false
)
def
gitlab_webpack_asset_paths
(
source
,
extension:
nil
,
force_same_domain:
false
)
return
""
unless
source
.
present?
return
""
unless
source
.
present?
...
...
app/views/layouts/_head.html.haml
View file @
dd75c337
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
=
webpack_bundle_tag
"webpack_runtime"
=
webpack_bundle_tag
"webpack_runtime"
=
webpack_bundle_tag
"common"
=
webpack_bundle_tag
"common"
=
webpack_bundle_tag
"main"
=
webpack_bundle_tag
"main"
=
webpack_controller_bundle_tags
=
webpack_bundle_tag
"raven"
if
current_application_settings
.
clientside_sentry_enabled
=
webpack_bundle_tag
"raven"
if
current_application_settings
.
clientside_sentry_enabled
=
webpack_bundle_tag
"test"
if
Rails
.
env
.
test?
=
webpack_bundle_tag
"test"
if
Rails
.
env
.
test?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment