-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cd2e66
commit 26bfeaf
Showing
79 changed files
with
519 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
/node_modules | ||
/vendor | ||
/public | ||
node_modules | ||
vendor | ||
public | ||
dist | ||
dist-ssr | ||
.env | ||
.budfiles | ||
npm-debug.log | ||
yarn-error.log | ||
*.local | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* Styles */ | ||
import '@styles/main.scss' | ||
|
||
/* Scripts */ | ||
import '@scripts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
init() {}, | ||
finalize() {}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('editor scripts loaded') |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Router from './utils/Router' | ||
import components from './components' | ||
import pages from './pages' | ||
|
||
const routes = new Router({ | ||
components, | ||
pages, | ||
}) | ||
|
||
window.addEventListener('DOMContentLoaded', () => { | ||
routes.loadEvents() | ||
components.init() | ||
pages.init() | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function () { | ||
console.log('home scripts loaded') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import home from './home' | ||
|
||
export default { | ||
init() { | ||
home() | ||
}, | ||
finalize() {}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import camelCase from './camelCase'; | ||
|
||
/** | ||
* DOM-based Routing | ||
* | ||
* Based on {@link http://goo.gl/EUTi53|Markup-based Unobtrusive Comprehensive DOM-ready Execution} by Paul Irish | ||
* | ||
* The routing fires all common scripts, followed by the page specific scripts. | ||
* Add additional events for more control over timing e.g. a finalize event | ||
*/ | ||
class Router { | ||
|
||
/** | ||
* Create a new Router | ||
* @param {Object} routes | ||
*/ | ||
constructor(routes) { | ||
this.routes = routes; | ||
} | ||
|
||
/** | ||
* Fire Router events | ||
* @param {string} route DOM-based route derived from body classes (`<body class="...">`) | ||
* @param {string} [event] Events on the route. By default, `init` and `finalize` events are called. | ||
* @param {string} [arg] Any custom argument to be passed to the event. | ||
*/ | ||
fire(route, event = 'init', arg) { | ||
document.dispatchEvent(new CustomEvent('routed', { | ||
bubbles: true, | ||
detail: { | ||
route, | ||
fn: event, | ||
}, | ||
})); | ||
|
||
const fire = route !== '' && this.routes[route] && typeof this.routes[route][event] === 'function'; | ||
if (fire) { | ||
this.routes[route][event](arg); | ||
} | ||
} | ||
|
||
/** | ||
* Automatically load and fire Router events | ||
* | ||
* Events are fired in the following order: | ||
* * common init | ||
* * page-specific init | ||
* * page-specific finalize | ||
* * common finalize | ||
*/ | ||
loadEvents() { | ||
// Fire common init JS | ||
this.fire('common'); | ||
|
||
// Fire page-specific init JS, and then finalize JS | ||
document.body.className | ||
.toLowerCase() | ||
.replace(/-/g, '_') | ||
.split(/\s+/) | ||
.map(camelCase) | ||
.forEach((className) => { | ||
this.fire(className); | ||
this.fire(className, 'finalize'); | ||
}); | ||
|
||
// Fire common finalize JS | ||
this.fire('common', 'finalize'); | ||
} | ||
} | ||
|
||
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* the most terrible camelizer on the internet, guaranteed! | ||
* @param {string} str String that isn't camel-case, e.g., CAMeL_CaSEiS-harD | ||
* @return {string} String converted to camel-case, e.g., camelCaseIsHard | ||
*/ | ||
export default str => `${str.charAt(0).toLowerCase()}${str.replace(/[\W_]/g, '|').split('|') | ||
.map(part => `${part.charAt(0).toUpperCase()}${part.slice(1)}`) | ||
.join('') | ||
.slice(1)}`; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.