File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,14 @@ that's included on every page:
15
15
16
16
// this creates a 'vendor.js' file with jquery and the bootstrap JS module
17
17
// 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
+ ])
19
26
20
27
As soon as you make this change, you need to include two extra JavaScript files
21
28
on your page before any other JavaScript file:
@@ -29,6 +36,9 @@ on your page before any other JavaScript file:
29
36
<!-- here you link to the specific JS files needed by the current page -->
30
37
<script src="{{ asset('build/app.js') }}"></script>
31
38
39
+ <!-- if you extracted some CSS, include vendor.css -->
40
+ <link rel="stylesheet" href="{{ asset('build/vendor.css') }}" />
41
+
32
42
The ``vendor.js `` file contains all the common code that has been extracted from
33
43
the other files, so it's obvious that it must be included. The other file (``manifest.js ``)
34
44
is less obvious: it's needed so that Webpack knows how to load those shared modules.
You can’t perform that action at this time.
0 commit comments