Commit 7da21562 by Huan Wang Committed by Dominik Prokop

grafana/toolkit: Add font file loader (#19781)

* add file loader for fonts

* Add public path to resolve fonts correctly

* Do not specify font's output path

* Output fonts to fonts directory
parent d0d59b80
import path from 'path';
let PLUGIN_ID: string;
export const getPluginId = () => {
if (!PLUGIN_ID) {
const pluginJson = require(path.resolve(process.cwd(), 'src/plugin.json'));
PLUGIN_ID = pluginJson.id;
}
return PLUGIN_ID;
};
import fs from 'fs';
import path from 'path';
import { getPluginId } from '../utils/getPluginId';
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
......@@ -139,5 +140,14 @@ export const getFileLoaders = () => {
},
],
},
{
test: /\.(woff|woff2|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader',
options: {
publicPath: `/public/plugins/${getPluginId()}/fonts`,
outputPath: 'fonts',
name: '[name].[ext]',
},
},
];
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment