Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1c2c46b

Browse filesBrowse files
committed
minor #8055 [Front-End] Adding note about extracting CSS (weaverryan)
This PR was merged into the 3.3 branch. Discussion ---------- [Front-End] Adding note about extracting CSS In Encore, the `createSharedEntry()` can also include CSS. See symfony/webpack-encore#20 Commits ------- 99f9b3a adding note about extracting CSS
2 parents 7abe4c3 + 99f9b3a commit 1c2c46b
Copy full SHA for 1c2c46b

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed

‎frontend/encore/shared-entry.rst

Copy file name to clipboardExpand all lines: frontend/encore/shared-entry.rst
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ that's included on every page:
1515
1616
// this creates a 'vendor.js' file with jquery and the bootstrap JS module
1717
// these modules will *not* be included in page1.js or page2.js anymore
18-
.createSharedEntry('vendor', ['jquery', 'bootstrap'])
18+
.createSharedEntry('vendor', [
19+
'jquery',
20+
'bootstrap',
21+
22+
// you can also extract CSS - this will create a 'vendor.css' file
23+
// this CSS will *not* be included in page1.css or page2.css anymore
24+
'bootstrap-sass/assets/stylesheets/_bootstrap.scss'
25+
])
1926
2027
As soon as you make this change, you need to include two extra JavaScript files
2128
on your page before any other JavaScript file:
@@ -29,6 +36,9 @@ on your page before any other JavaScript file:
2936
<!-- here you link to the specific JS files needed by the current page -->
3037
<script src="{{ asset('build/app.js') }}"></script>
3138
39+
<!-- if you extracted some CSS, include vendor.css -->
40+
<link rel="stylesheet" href="{{ asset('build/vendor.css') }}" />
41+
3242
The ``vendor.js`` file contains all the common code that has been extracted from
3343
the other files, so it's obvious that it must be included. The other file (``manifest.js``)
3444
is less obvious: it's needed so that Webpack knows how to load those shared modules.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.