diff --git a/packages/varlet-cli/site/components/icon/icon.less b/packages/varlet-cli/site/components/icon/icon.less index d2ab75a833f..4ded5b566d6 100644 --- a/packages/varlet-cli/site/components/icon/icon.less +++ b/packages/varlet-cli/site/components/icon/icon.less @@ -7,6 +7,7 @@ } .var-site-icon { + position: relative; display: inline-flex; justify-content: center; align-items: center; @@ -14,6 +15,16 @@ color: inherit; vertical-align: bottom; + &::before { + position: relative; + display: inline-block; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + font-weight: normal; + font-style: normal; + } + &--shrinking { transform: scale(0); } diff --git a/packages/varlet-icons/lib/index.js b/packages/varlet-icons/lib/index.js index 5ec1f886683..0b1ba6feaef 100755 --- a/packages/varlet-icons/lib/index.js +++ b/packages/varlet-icons/lib/index.js @@ -18,7 +18,7 @@ async function build() { const { base64, publicPath, namespace, fontName, fileName, fontWeight = 'normal', fontStyle = 'normal' } = config - const { ttf, woff, woff2 } = await webfont.default({ + const { ttf } = await webfont.default({ files: `${SVG_DIR}/*.svg`, fontName, formats, @@ -53,31 +53,15 @@ ${iconNames.join(',\n')} font-family: "${fontName}"; src: url("${ base64 - ? `data:application/font-woff2;charset=utf-8;base64,${Buffer.from(woff2).toString('base64')}` - : `${publicPath}${fileName}-webfont.woff2` - }") format("woff2"), - url("${ - base64 - ? `data:application/font-woff;charset=utf-8;base64,${woff.toString('base64')}` - : `${publicPath}${fileName}-webfont.woff` - }") format("woff"), - url("${ - base64 - ? `data:font/truetype;charset=utf-8;base64,${ttf.toString('base64')}` - : `${publicPath}${fileName}-webfont.ttf` - }") format("truetype"); + ? `data:font/truetype;charset=utf-8;base64,${ttf.toString('base64')}` + : `${publicPath}${fileName}-webfont.ttf` + }") format("truetype"); font-weight: ${fontWeight}; font-style: ${fontStyle}; } -.${namespace}--set, -.${namespace}--set::before { - position: relative; - display: inline-block; - font: normal normal normal 14px/1 "${fontName}"; - font-size: inherit; - text-rendering: auto; - -webkit-font-smoothing: antialiased; +.${namespace}--set { + font-family: "${fontName}"; } ${icons @@ -91,8 +75,6 @@ ${icons await Promise.all([ writeFile(resolve(FONTS_DIR, `${fileName}-webfont.ttf`), ttf), - writeFile(resolve(FONTS_DIR, `${fileName}-webfont.woff`), woff), - writeFile(resolve(FONTS_DIR, `${fileName}-webfont.woff2`), woff2), writeFile(resolve(CSS_DIR, `${fileName}.css`), cssTemplate), writeFile(resolve(CSS_DIR, `${fileName}.less`), cssTemplate), writeFile(resolve(DIST_DIR, 'index.js'), indexTemplate), diff --git a/packages/varlet-ui/src/checkbox-group/__tests__/__snapshots__/index.spec.js.snap b/packages/varlet-ui/src/checkbox-group/__tests__/__snapshots__/index.spec.js.snap index ce80f66eda4..eec93d6189f 100644 --- a/packages/varlet-ui/src/checkbox-group/__tests__/__snapshots__/index.spec.js.snap +++ b/packages/varlet-ui/src/checkbox-group/__tests__/__snapshots__/index.spec.js.snap @@ -4,7 +4,7 @@ exports[`test checkbox example 1`] = ` "