-
Notifications
You must be signed in to change notification settings - Fork 7
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
7ea44f7
commit feb20bc
Showing
2 changed files
with
58 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
diff --git a/node_modules/@greenwood/cli/src/lib/layout-utils.js b/node_modules/@greenwood/cli/src/lib/layout-utils.js | ||
index e397396..8dbf281 100644 | ||
--- a/node_modules/@greenwood/cli/src/lib/layout-utils.js | ||
+++ b/node_modules/@greenwood/cli/src/lib/layout-utils.js | ||
@@ -227,15 +227,29 @@ async function getAppLayout(pageLayoutContents, compilation, customImports = [], | ||
const mergedStyles = [ | ||
...appRoot.querySelectorAll('head style'), | ||
...[...(pageRoot && pageRoot.querySelectorAll('head style')) || []], | ||
- ...customImports.filter(resource => resource.split('.').pop() === 'css') | ||
- .map(resource => `<link rel="stylesheet" href="${resource}"></link>`) | ||
+ ...customImports.filter(resource => resource.split(' ')[0].split('.').pop() === 'css') | ||
+ .map((resource) => { | ||
+ const [href, ...attributes] = resource.split(' '); | ||
+ const attrs = attributes?.length > 0 | ||
+ ? attributes.join(' ') | ||
+ : ''; | ||
+ | ||
+ return `<link rel="stylesheet" href="${href}" ${attrs}></link>`; | ||
+ }) | ||
].join('\n'); | ||
|
||
const mergedScripts = [ | ||
...appRoot.querySelectorAll('head script'), | ||
...[...(pageRoot && pageRoot.querySelectorAll('head script')) || []], | ||
- ...customImports.filter(resource => resource.split('.').pop() === 'js') | ||
- .map(resource => `<script src="${resource}" type="module"></script>`) | ||
+ ...customImports.filter(resource => resource.split(' ')[0].split('.').pop() === 'js') | ||
+ .map((resource) => { | ||
+ const [src, ...attributes] = resource.split(' '); | ||
+ const attrs = attributes?.length > 0 | ||
+ ? attributes.join(' ') | ||
+ : ''; | ||
+ | ||
+ return `<script src="${src}" ${attrs}></script>`; | ||
+ }) | ||
].join('\n'); | ||
|
||
const finalBody = pageLayoutContents | ||
diff --git a/node_modules/@greenwood/cli/src/lifecycles/bundle.js b/node_modules/@greenwood/cli/src/lifecycles/bundle.js | ||
index 21636a9..7a01fe0 100644 | ||
--- a/node_modules/@greenwood/cli/src/lifecycles/bundle.js | ||
+++ b/node_modules/@greenwood/cli/src/lifecycles/bundle.js | ||
@@ -105,7 +105,7 @@ async function optimizeStaticPages(compilation, plugins) { | ||
} | ||
|
||
// clean up optimization markers | ||
- const body = (await response.text()).replace(/data-gwd-opt=".*[a-z]"/g, ''); | ||
+ const body = (await response.text()).replace(/data-gwd-opt=".*?[a-z]"/g, ''); | ||
|
||
await fs.writeFile(new URL(`.${outputPath}`, outputDir), body); | ||
}) |
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