Skip to content

Commit

Permalink
Merge commit '712347b0966ea473b86c33b62dabd91185fbe2e7' into feature/…
Browse files Browse the repository at this point in the history
…entry-battery-level-check
  • Loading branch information
ThornWalli committed Sep 13, 2023
2 parents 2b9206c + 712347b commit 5d5332e
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 177 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Project Changelog

# [3.0.0-next.23](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.22...v3.0.0-next.23) (2023-09-13)


### Bug Fixes

* **module:** improve critters handling ([315e2fe](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/315e2fe5aa764ba9da424e26d14eb5bb088ddb70))

# [3.0.0-next.22](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.21...v3.0.0-next.22) (2023-09-13)


Expand Down
165 changes: 16 additions & 149 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-speedkit",
"version": "3.0.0-next.22",
"version": "3.0.0-next.23",
"description": "Nuxt Speedkit takes over the Lighthouse performance optimization of your generated website.",
"license": "MIT",
"contributors": [
Expand Down Expand Up @@ -69,7 +69,7 @@
"@commitlint/config-conventional": "17.7.0",
"@fullhuman/postcss-purgecss": "5.0.0",
"@nuxt/module-builder": "0.5.1",
"@nuxt/webpack-builder": "3.7.1",
"@nuxt/webpack-builder": "3.7.2",
"@nuxtjs/eslint-config": "12.0.0",
"@nuxtjs/eslint-module": "4.1.0",
"@nuxtjs/stylelint-module": "5.1.0",
Expand All @@ -90,7 +90,7 @@
"husky": "8.0.3",
"jsdom": "22.1.0",
"lint-staged": "14.0.1",
"nuxt": "^3.7.2",
"nuxt": "3.7.2",
"pinst": "3.0.0",
"playwright": "1.37.1",
"postcss-functions": "4.0.2",
Expand Down
3 changes: 2 additions & 1 deletion src/module.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ async function addBuildTemplates(nuxt, options) {

addTemplate({
filename: MODULE_NAME + '/fonts.css',
getContents: () => fontConfig.toCSS(),
getContents: () =>
`/*! speedkit-font-faces start */${fontConfig.toCSS()}/*! speedkit-font-faces end */`,
write: true
});

Expand Down
18 changes: 10 additions & 8 deletions src/runtime/classes/Font.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ export default class Font {

getCSSText({ usedFontaine = false } = {}) {
const selector = createSelector(this.rootSelector, this.selector);
const family = prepareFamily(this.family, { usedFontaine });
const family = `"${this.family}"`;
return wrapByMedia(
`${selector} {
font-family: ${this.fallbackFamily.join(', ')};
font-family: ${[getFontaineFallback(this.family, usedFontaine)]
.filter(Boolean)
.concat(this.fallbackFamily.join(', '))};
font-weight: ${this.weight};
font-style: ${this.style};
}
Expand All @@ -64,9 +66,9 @@ export default class Font {
);
}

getNoScriptCSSText({ usedFontaine = false } = {}) {
getNoScriptCSSText() {
const selector = createSelector(this.rootSelector, this.selector);
const family = prepareFamily(this.family, { usedFontaine });
const family = `"${this.family}"`;
return wrapByMedia(
`${selector} {
font-family: ${[family].concat(this.fallbackFamily).join(', ')};
Expand Down Expand Up @@ -123,9 +125,9 @@ function weightNormalize(weight) {
}
}

function prepareFamily(family, { usedFontaine = false } = {}) {
if (!usedFontaine) {
return `"${family}"`;
function getFontaineFallback(family, usedFontaine) {
if (usedFontaine) {
return `"${family} fallback"`;
}
return `"${family}", "${family} fallback"`;
return '';
}
4 changes: 2 additions & 2 deletions src/runtime/classes/FontCollection.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export default class FontCollection {
]);
}

getNoScriptStyleDescriptions(options) {
getNoScriptStyleDescriptions() {
return getRelevantDescriptions([
getStyleDescription(
this.list.map(font => font.getNoScriptCSSText(options)).join(' '),
this.list.map(font => font.getNoScriptCSSText()).join(' '),
true
)
]);
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/fonts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function writeHead(isCritical, fontCollection, runtimeConfig) {
return fontCollection.getStyleDescriptions(options);
}),
noscript: computed(() => {
return fontCollection.getNoScriptStyleDescriptions(options);
return fontCollection.getNoScriptStyleDescriptions();
})
});
}
Loading

0 comments on commit 5d5332e

Please sign in to comment.