unplugin-fonts
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1584,36 +1584,24 @@ "use strict"; | ||
if (typeof family === "string") { | ||
source.push(`@import "@fontsource/${family.toLowerCase()}";`); | ||
const name2 = family.toLowerCase().replace(/ /g, "-"); | ||
source.push(`@import "@fontsource/${name2}";`); | ||
continue; | ||
} | ||
const { | ||
name, | ||
variables, | ||
weights, | ||
styles, | ||
subset | ||
} = family; | ||
const subsetPrefix = subset ? `${subset}-` : ""; | ||
if (variables) { | ||
if (weights) | ||
console.warn("unplugin-fonts: Variable fonts does not support weights. Ignoring weights."); | ||
for (const variable of variables) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${variable}.css";`); | ||
} else if (weights) { | ||
for (const weight of weights) { | ||
if (styles) { | ||
for (const style of styles) { | ||
const name = family.name.toLowerCase().replace(/ /g, "-"); | ||
const subsetPrefix = family.subset ? `${family.subset}-` : ""; | ||
if ("variables" in family) { | ||
for (const variable of family.variables) | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${variable}.css";`); | ||
} else if ("weights" in family) { | ||
for (const weight of family.weights) { | ||
if (family.styles) { | ||
for (const style of family.styles) { | ||
if (style === "normal") | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${style}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}-${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}-${style}.css";`); | ||
} | ||
} else { | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}.css";`); | ||
} | ||
} | ||
} else { | ||
if (subset) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subset}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}";`); | ||
} | ||
@@ -1648,3 +1636,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1662,3 +1650,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1665,0 +1653,0 @@ } |
@@ -1584,36 +1584,24 @@ "use strict"; | ||
if (typeof family === "string") { | ||
source.push(`@import "@fontsource/${family.toLowerCase()}";`); | ||
const name2 = family.toLowerCase().replace(/ /g, "-"); | ||
source.push(`@import "@fontsource/${name2}";`); | ||
continue; | ||
} | ||
const { | ||
name, | ||
variables, | ||
weights, | ||
styles, | ||
subset | ||
} = family; | ||
const subsetPrefix = subset ? `${subset}-` : ""; | ||
if (variables) { | ||
if (weights) | ||
console.warn("unplugin-fonts: Variable fonts does not support weights. Ignoring weights."); | ||
for (const variable of variables) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${variable}.css";`); | ||
} else if (weights) { | ||
for (const weight of weights) { | ||
if (styles) { | ||
for (const style of styles) { | ||
const name = family.name.toLowerCase().replace(/ /g, "-"); | ||
const subsetPrefix = family.subset ? `${family.subset}-` : ""; | ||
if ("variables" in family) { | ||
for (const variable of family.variables) | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${variable}.css";`); | ||
} else if ("weights" in family) { | ||
for (const weight of family.weights) { | ||
if (family.styles) { | ||
for (const style of family.styles) { | ||
if (style === "normal") | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${style}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}-${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}-${style}.css";`); | ||
} | ||
} else { | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}.css";`); | ||
} | ||
} | ||
} else { | ||
if (subset) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subset}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}";`); | ||
} | ||
@@ -1648,3 +1636,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1662,3 +1650,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1665,0 +1653,0 @@ } |
@@ -1584,36 +1584,24 @@ "use strict"; | ||
if (typeof family === "string") { | ||
source.push(`@import "@fontsource/${family.toLowerCase()}";`); | ||
const name2 = family.toLowerCase().replace(/ /g, "-"); | ||
source.push(`@import "@fontsource/${name2}";`); | ||
continue; | ||
} | ||
const { | ||
name, | ||
variables, | ||
weights, | ||
styles, | ||
subset | ||
} = family; | ||
const subsetPrefix = subset ? `${subset}-` : ""; | ||
if (variables) { | ||
if (weights) | ||
console.warn("unplugin-fonts: Variable fonts does not support weights. Ignoring weights."); | ||
for (const variable of variables) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${variable}.css";`); | ||
} else if (weights) { | ||
for (const weight of weights) { | ||
if (styles) { | ||
for (const style of styles) { | ||
const name = family.name.toLowerCase().replace(/ /g, "-"); | ||
const subsetPrefix = family.subset ? `${family.subset}-` : ""; | ||
if ("variables" in family) { | ||
for (const variable of family.variables) | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${variable}.css";`); | ||
} else if ("weights" in family) { | ||
for (const weight of family.weights) { | ||
if (family.styles) { | ||
for (const style of family.styles) { | ||
if (style === "normal") | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${style}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}-${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}-${style}.css";`); | ||
} | ||
} else { | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}.css";`); | ||
} | ||
} | ||
} else { | ||
if (subset) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subset}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}";`); | ||
} | ||
@@ -1648,3 +1636,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1662,3 +1650,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1665,0 +1653,0 @@ } |
@@ -1585,36 +1585,24 @@ "use strict"; | ||
if (typeof family === "string") { | ||
source.push(`@import "@fontsource/${family.toLowerCase()}";`); | ||
const name2 = family.toLowerCase().replace(/ /g, "-"); | ||
source.push(`@import "@fontsource/${name2}";`); | ||
continue; | ||
} | ||
const { | ||
name, | ||
variables, | ||
weights, | ||
styles, | ||
subset | ||
} = family; | ||
const subsetPrefix = subset ? `${subset}-` : ""; | ||
if (variables) { | ||
if (weights) | ||
console.warn("unplugin-fonts: Variable fonts does not support weights. Ignoring weights."); | ||
for (const variable of variables) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${variable}.css";`); | ||
} else if (weights) { | ||
for (const weight of weights) { | ||
if (styles) { | ||
for (const style of styles) { | ||
const name = family.name.toLowerCase().replace(/ /g, "-"); | ||
const subsetPrefix = family.subset ? `${family.subset}-` : ""; | ||
if ("variables" in family) { | ||
for (const variable of family.variables) | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${variable}.css";`); | ||
} else if ("weights" in family) { | ||
for (const weight of family.weights) { | ||
if (family.styles) { | ||
for (const style of family.styles) { | ||
if (style === "normal") | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${style}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}-${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}-${style}.css";`); | ||
} | ||
} else { | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}.css";`); | ||
} | ||
} | ||
} else { | ||
if (subset) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subset}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}";`); | ||
} | ||
@@ -1649,3 +1637,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1663,3 +1651,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1688,4 +1676,6 @@ } | ||
var _a, _b, _c; | ||
(_a = nuxt.options).css || (_a.css = []); | ||
nuxt.options.css.push("unfonts.css"); | ||
if ("fontsource" in options || "custom" in options) { | ||
(_a = nuxt.options).css || (_a.css = []); | ||
nuxt.options.css.push("unfonts.css"); | ||
} | ||
const links = getHeadLinkTags(options, nuxt.options.rootDir); | ||
@@ -1692,0 +1682,0 @@ (_b = nuxt.options.app).head || (_b.head = {}); |
@@ -1584,36 +1584,24 @@ "use strict"; | ||
if (typeof family === "string") { | ||
source.push(`@import "@fontsource/${family.toLowerCase()}";`); | ||
const name2 = family.toLowerCase().replace(/ /g, "-"); | ||
source.push(`@import "@fontsource/${name2}";`); | ||
continue; | ||
} | ||
const { | ||
name, | ||
variables, | ||
weights, | ||
styles, | ||
subset | ||
} = family; | ||
const subsetPrefix = subset ? `${subset}-` : ""; | ||
if (variables) { | ||
if (weights) | ||
console.warn("unplugin-fonts: Variable fonts does not support weights. Ignoring weights."); | ||
for (const variable of variables) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${variable}.css";`); | ||
} else if (weights) { | ||
for (const weight of weights) { | ||
if (styles) { | ||
for (const style of styles) { | ||
const name = family.name.toLowerCase().replace(/ /g, "-"); | ||
const subsetPrefix = family.subset ? `${family.subset}-` : ""; | ||
if ("variables" in family) { | ||
for (const variable of family.variables) | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${variable}.css";`); | ||
} else if ("weights" in family) { | ||
for (const weight of family.weights) { | ||
if (family.styles) { | ||
for (const style of family.styles) { | ||
if (style === "normal") | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${style}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}-${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}-${style}.css";`); | ||
} | ||
} else { | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}.css";`); | ||
} | ||
} | ||
} else { | ||
if (subset) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subset}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}";`); | ||
} | ||
@@ -1648,3 +1636,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1662,3 +1650,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1665,0 +1653,0 @@ } |
@@ -6,2 +6,3 @@ interface Options { | ||
typekit?: TypeKitFonts; | ||
sourcemap?: string; | ||
} | ||
@@ -8,0 +9,0 @@ interface CustomFontFace { |
@@ -1584,36 +1584,24 @@ "use strict"; | ||
if (typeof family === "string") { | ||
source.push(`@import "@fontsource/${family.toLowerCase()}";`); | ||
const name2 = family.toLowerCase().replace(/ /g, "-"); | ||
source.push(`@import "@fontsource/${name2}";`); | ||
continue; | ||
} | ||
const { | ||
name, | ||
variables, | ||
weights, | ||
styles, | ||
subset | ||
} = family; | ||
const subsetPrefix = subset ? `${subset}-` : ""; | ||
if (variables) { | ||
if (weights) | ||
console.warn("unplugin-fonts: Variable fonts does not support weights. Ignoring weights."); | ||
for (const variable of variables) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${variable}.css";`); | ||
} else if (weights) { | ||
for (const weight of weights) { | ||
if (styles) { | ||
for (const style of styles) { | ||
const name = family.name.toLowerCase().replace(/ /g, "-"); | ||
const subsetPrefix = family.subset ? `${family.subset}-` : ""; | ||
if ("variables" in family) { | ||
for (const variable of family.variables) | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${variable}.css";`); | ||
} else if ("weights" in family) { | ||
for (const weight of family.weights) { | ||
if (family.styles) { | ||
for (const style of family.styles) { | ||
if (style === "normal") | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${style}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}-${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}-${style}.css";`); | ||
} | ||
} else { | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}.css";`); | ||
} | ||
} | ||
} else { | ||
if (subset) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subset}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}";`); | ||
} | ||
@@ -1648,3 +1636,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1662,3 +1650,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1665,0 +1653,0 @@ } |
@@ -1584,36 +1584,24 @@ "use strict"; | ||
if (typeof family === "string") { | ||
source.push(`@import "@fontsource/${family.toLowerCase()}";`); | ||
const name2 = family.toLowerCase().replace(/ /g, "-"); | ||
source.push(`@import "@fontsource/${name2}";`); | ||
continue; | ||
} | ||
const { | ||
name, | ||
variables, | ||
weights, | ||
styles, | ||
subset | ||
} = family; | ||
const subsetPrefix = subset ? `${subset}-` : ""; | ||
if (variables) { | ||
if (weights) | ||
console.warn("unplugin-fonts: Variable fonts does not support weights. Ignoring weights."); | ||
for (const variable of variables) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${variable}.css";`); | ||
} else if (weights) { | ||
for (const weight of weights) { | ||
if (styles) { | ||
for (const style of styles) { | ||
const name = family.name.toLowerCase().replace(/ /g, "-"); | ||
const subsetPrefix = family.subset ? `${family.subset}-` : ""; | ||
if ("variables" in family) { | ||
for (const variable of family.variables) | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${variable}.css";`); | ||
} else if ("weights" in family) { | ||
for (const weight of family.weights) { | ||
if (family.styles) { | ||
for (const style of family.styles) { | ||
if (style === "normal") | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${style}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}-${style}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}-${style}.css";`); | ||
} | ||
} else { | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subsetPrefix}${weight}.css";`); | ||
source.push(`@import "@fontsource/${name}/${subsetPrefix}${weight}.css";`); | ||
} | ||
} | ||
} else { | ||
if (subset) | ||
source.push(`@import "@fontsource/${name.toLowerCase()}/${subset}.css";`); | ||
else | ||
source.push(`@import "@fontsource/${name.toLowerCase()}";`); | ||
} | ||
@@ -1648,3 +1636,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1662,3 +1650,3 @@ } | ||
code: s.toString(), | ||
map: s.generateMap({ source: id, includeContent: true }) | ||
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0 | ||
}; | ||
@@ -1665,0 +1653,0 @@ } |
{ | ||
"name": "unplugin-fonts", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Universal Webfont loader", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
420023
13505