Merge pull request #7019 from backstage/rugvip/fonts

cli: added support for importing font files
This commit is contained in:
Patrik Oldsberg
2021-09-01 09:54:31 +02:00
committed by GitHub
4 changed files with 47 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Added support for importing font files. Imports in CSS via `url()` are supported for the final frontend bundle, but not for packages that are built for publishing. Module imports of fonts files from TypeScript are supported everywhere.
+20
View File
@@ -68,6 +68,26 @@ declare module '*.svg' {
export default src;
}
declare module '*.eot' {
const src: string;
export default src;
}
declare module '*.woff' {
const src: string;
export default src;
}
declare module '*.woff2' {
const src: string;
export default src;
}
declare module '*.ttf' {
const src: string;
export default src;
}
declare module '*.css' {
const classes: { readonly [key: string]: string };
export default classes;
+11 -1
View File
@@ -80,7 +80,17 @@ export const makeConfigs = async (
postcss(),
forwardFileImports({
exclude: /\.icon\.svg$/,
include: [/\.svg$/, /\.png$/, /\.gif$/, /\.jpg$/, /\.jpeg$/],
include: [
/\.svg$/,
/\.png$/,
/\.gif$/,
/\.jpg$/,
/\.jpeg$/,
/\.eot$/,
/\.woff$/,
/\.woff2$/,
/\.ttf$/,
],
}),
json(),
yaml(),
@@ -89,6 +89,17 @@ export const transforms = (options: TransformOptions): Transforms => {
name: 'static/[name].[hash:8].[ext]',
},
},
{
test: /\.(eot|woff|woff2|ttf)$/,
use: [
{
loader: require.resolve('file-loader'),
options: {
name: 'static/[name].[hash:8].[ext]',
},
},
],
},
{
test: /\.ya?ml$/,
use: require.resolve('yml-loader'),