Skip to content

Commit

Permalink
clean up missed TODOs and console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Apr 3, 2021
1 parent 6180ea7 commit b322ac0
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 13 deletions.
3 changes: 0 additions & 3 deletions packages/cli/src/config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ function greenwoodHtmlPlugin(compilation) {
} else {
const { src } = parsedAttributes;

// TODO avoid using href and set it to the value of rollup fileName instead
// since user paths can still be the same file,
// e.g. ../theme.css and ./theme.css are still the same file
mappedScripts.set(src, true);

const srcPath = src.replace('../', './');
Expand Down
7 changes: 1 addition & 6 deletions packages/cli/src/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ document.addEventListener('click', function(e) {
e.preventDefault();

if (e.path[0].href) {
console.debug('linked clicked was...', e.path[0].href);
const target = e.path[0];
const route = target.href.replace(window.location.origin, '');
const routerOutlet = Array.from(document.getElementsByTagName('greenwood-route')).filter(outlet => {
return outlet.getAttribute('data-route') === route;
})[0];

console.debug('routerOutlet', routerOutlet);

if (routerOutlet.getAttribute('data-template') === window.__greenwood.currentTemplate) {
window.__greenwood.currentTemplate = routerOutlet.getAttribute('data-template');
routerOutlet.loadRoute();
} else {
console.debug('new template detected, should do a hard reload');
window.location.href = target;
}
}
Expand All @@ -26,8 +22,7 @@ class RouteComponent extends HTMLElement {
loadRoute() {
const route = this.getAttribute('data-route');
const key = this.getAttribute('data-key');
console.debug('load route ->', route);
console.debug('with bundle ->', key);

fetch(key)
.then(res => res.text())
.then((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en" prefix="og:http://ogp.me/ns#">

<head>
<!-- TODO have to use forward slash / for path references? translate on the fly in serve.js? -->
<script type="module" src="/components/header.js"></script>
<link rel="stylesheet" href="/styles/theme.css"></link>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en" prefix="og:http://ogp.me/ns#">

<head>
<!-- TODO have to use forward slash / for path references? translate on the fly in serve.js? -->
<script type="module" src="/components/header.js"></script>
<link rel="stylesheet" href="/styles/theme.css"></link>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en" prefix="og:http://ogp.me/ns#">

<head>
<!-- TODO have to use forward slash / for path references? translate on the fly in serve.js? -->
<script type="module" src="/components/header.js"></script>
<link rel="stylesheet" href="/styles/theme.css"></link>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en" prefix="og:http://ogp.me/ns#">

<head>
<!-- TODO have to use forward slash / for path references? translate on the fly in serve.js? -->
<script type="module" src="/components/header.js"></script>
</head>

Expand Down

0 comments on commit b322ac0

Please sign in to comment.