Skip to content

Commit

Permalink
feat(preset-web-fonts): reuse preflights layer
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 1, 2022
1 parent f29576a commit 1000830
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
4 changes: 0 additions & 4 deletions packages/preset-web-fonts/src/index.ts
Expand Up @@ -6,8 +6,6 @@ import type { WebFontMeta, WebFontsOptions, WebFontsProviders } from './types'

export * from './types'

const layerName = '__webfonts__'

export function normalizedFontMeta(meta: WebFontMeta | string, defaultProvider: WebFontsProviders): WebFontMeta {
if (typeof meta !== 'string') {
meta.provider = meta.provider ?? defaultProvider
Expand Down Expand Up @@ -66,7 +64,6 @@ const preset = (options: WebFontsOptions = {}): Preset<any> => {

const preset: Preset<any> = {
name: '@unocss/preset-web-fonts',
layers: { [layerName]: -40 },
preflights: [
{
async getCSS() {
Expand All @@ -88,7 +85,6 @@ const preset = (options: WebFontsOptions = {}): Preset<any> => {

return preflights.filter(Boolean).join('\n')
},
layer: layerName,
},
],
}
Expand Down
1 change: 0 additions & 1 deletion test/__snapshots__/preset-web-fonts.test.ts.snap
Expand Up @@ -3,7 +3,6 @@
exports[`web-fonts (inline: false) 1`] = `
"/* layer: preflights */
:root{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;}
/* layer: __webfonts__ */
@import url('https://fonts.googleapis.com/css2?family=Roboto&family=Fira+Code&family=Fira+Mono:wght@400;700&family=Lobster&family=Lato:ital,wght@0,400;0,700;1,400;1,700&display=swap')
/* layer: default */
.font-lato{font-family:\\"Lato\\",sans-serif;}
Expand Down

0 comments on commit 1000830

Please sign in to comment.