Add support for locally hosted fonts

This commit is contained in:
Art Lowel
2019-11-22 18:14:02 +01:00
parent 3c0adf9b12
commit b34e636379

View File

@@ -15,6 +15,9 @@ module.exports = (env) => {
let copyWebpackOptions = [{ let copyWebpackOptions = [{
from: path.join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'), from: path.join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
to: path.join('assets', 'fonts') to: path.join('assets', 'fonts')
}, {
from: path.join(__dirname, '..', 'resources', 'fonts'),
to: path.join('assets', 'fonts')
}, { }, {
from: path.join(__dirname, '..', 'resources', 'images'), from: path.join(__dirname, '..', 'resources', 'images'),
to: path.join('assets', 'images') to: path.join('assets', 'images')
@@ -24,6 +27,15 @@ module.exports = (env) => {
} }
]; ];
const themeFonts = path.join(themePath, 'resources', 'fonts');
if(theme && fs.existsSync(themeFonts)) {
copyWebpackOptions.push({
from: themeFonts,
to: path.join('assets', 'fonts') ,
force: true,
});
}
const themeImages = path.join(themePath, 'resources', 'images'); const themeImages = path.join(themePath, 'resources', 'images');
if(theme && fs.existsSync(themeImages)) { if(theme && fs.existsSync(themeImages)) {
copyWebpackOptions.push({ copyWebpackOptions.push({
@@ -161,7 +173,7 @@ module.exports = (env) => {
] ]
}, },
{ {
test: /\.html$/, test: /\.(html|eot|ttf|svg|woff|woff2)$/,
loader: 'raw-loader' loader: 'raw-loader'
} }
] ]