File tree Expand file tree Collapse file tree 10 files changed +35
-8637
lines changed
Expand file tree Collapse file tree 10 files changed +35
-8637
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "plugins" : [" @babel/plugin-syntax-dynamic-import" ]
3+ }
Original file line number Diff line number Diff line change 1616 "test" : " run-s -c lint"
1717 },
1818 "devDependencies" : {
19+ "@babel/plugin-syntax-dynamic-import" : " ^7.2.0" ,
1920 "browser-sync" : " ^2.26.5" ,
2021 "browser-sync-webpack-plugin" : " 2.0.1" ,
2122 "cross-env" : " ^5.2.0" ,
3334 "dependencies" : {
3435 "bootstrap" : " ^4.3.1" ,
3536 "jquery" : " ^3.4.0" ,
37+ "js-dom-router" : " ^1.0.0" ,
3638 "popper.js" : " ^1.15.0"
3739 }
3840}
Original file line number Diff line number Diff line change 33 */
44import 'jquery' ;
55import 'bootstrap' ;
6+ import { router } from 'js-dom-router' ;
67
78/**
8- * Local Dependencies
9+ * DOM-based routing
910 */
10- import Router from './util/Router' ;
11- import common from './routes/common' ;
12- import aboutUs from './routes/about' ;
13- import { ready } from './utils' ;
11+ import about from './routes/about' ;
1412
1513/**
16- * Populate the Router instance with DOM routes .
14+ * Below is an example of a dynamic import; it will not be loaded until it's needed .
1715 *
18- * common – Fired on all pages.
19- * aboutUs – Fired on the About Us page, note the change from about-us to aboutUs (camelCase).
16+ * See: {@link https://webpack.js.org/guides/code-splitting/#dynamic-imports | Dynamic Imports}
2017 */
21- const routes = new Router ( {
22- common,
23- aboutUs,
24- } ) ;
18+ const home = async ( ) => import ( /* webpackChunkName: "home-page" */ './routes/home' ) ;
2519
2620/**
27- * Load Events
21+ * Set up DOM router
22+ *
23+ * .on(<name of body class>, callback)
24+ *
25+ * See: {@link http://goo.gl/EUTi53 | Markup-based Unobtrusive Comprehensive DOM-ready Execution} by Paul Irish
2826 */
29- ready ( ( ) => routes . loadEvents ( ) ) ;
27+ router
28+ . on ( 'about-us' , about )
29+ . on ( 'home' , async ( event ) => ( await home ( ) ) . default ( event ) )
30+ . ready ( ) ;
Original file line number Diff line number Diff line change 11/**
22 * About Us
3- *
4- * init – Fired on About Us page.
5- * finalized – Fired on About Us page, after page specific JS is fired.
63 */
7- export default {
8- init ( ) {
9- //
10- } ,
11- finalize ( ) {
12- //
13- } ,
4+ export default ( ) => {
5+ //--
146} ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ /**
2+ * Home
3+ */
4+ export default ( ) => {
5+ //--
6+ } ;
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ const src = path => `resources/assets/${path}`;
1818 */
1919
2020// Public Path
21- mix . setPublicPath ( './dist' ) ;
21+ // Public Path
22+ mix
23+ . setPublicPath ( './dist' )
24+ . setResourceRoot ( `/app/themes/sage/${ mix . config . publicPath } /` )
25+ . webpackConfig ( {
26+ output : { publicPath : mix . config . resourceRoot }
27+ } ) ;
2228
2329// Browsersync
2430mix . browserSync ( {
You can’t perform that action at this time.
0 commit comments