* build(webpack): move CopyUniconsPlugin into own file
* chore(webpack): delete unused blobUrl and compile loaders
* build(webpack): prefer contenthash over fullhash for longer caching
* build(webpack): set optimization.moduleIds named only in dev
* build(webpack): introduce HTMLWebpackCSSChunks so templates can access theme css by name
* feat: inject css files with contenthash in html templates
* revert(error-template): remove ContentDeliveryURL from CSS href
* refactor(index-template): update grafanaBootData.themePaths
* chore(webpack): add typescript annotations for CopyUniconsPlugin
(cherry picked from commit 78bef7a26a)
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
This commit is contained in:
co-authored by
Jack Westbrook
parent
83b73db401
commit
db1c49a95b
@@ -0,0 +1,39 @@
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
class CopyUniconsPlugin {
|
||||
/**
|
||||
* @param {import('webpack').Compiler} compiler
|
||||
*/
|
||||
apply(compiler) {
|
||||
compiler.hooks.afterEnvironment.tap(
|
||||
'CopyUniconsPlugin',
|
||||
/**
|
||||
* @param {import('webpack').Compilation} compilation
|
||||
*/
|
||||
() => {
|
||||
let destDir = path.resolve(__dirname, '../../../public/img/icons/unicons');
|
||||
|
||||
if (!fs.pathExistsSync(destDir)) {
|
||||
let srcDir = path.join(
|
||||
path.dirname(require.resolve('iconscout-unicons-tarball/package.json')),
|
||||
'unicons/svg/line'
|
||||
);
|
||||
fs.copySync(srcDir, destDir);
|
||||
}
|
||||
|
||||
let solidDestDir = path.resolve(__dirname, '../../../public/img/icons/solid');
|
||||
|
||||
if (!fs.pathExistsSync(solidDestDir)) {
|
||||
let srcDir = path.join(
|
||||
path.dirname(require.resolve('iconscout-unicons-tarball/package.json')),
|
||||
'unicons/svg/solid'
|
||||
);
|
||||
fs.copySync(srcDir, solidDestDir);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CopyUniconsPlugin;
|
||||
Reference in New Issue
Block a user