Skip to content

Commit

Permalink
Merge pull request #475 from dotkernel/issue-439
Browse files Browse the repository at this point in the history
updated webpack config - fonts fix
  • Loading branch information
arhimede authored Sep 4, 2024
2 parents 06760b2 + 73ae088 commit 4e54440
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Binary file added public/fonts/app/Avenir-Light.ttf
Binary file not shown.
Binary file added public/fonts/app/Minion-Pro.ttf
Binary file not shown.
26 changes: 20 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const appModules = [{
assets_path: './App/assets',
styles: true,
js: true,
images: true
images: true,
fonts: true
}];


Expand Down Expand Up @@ -54,9 +55,7 @@ const TerserPlugin = require('terser-webpack-plugin');


// dynamically build webpack entries based on registered app modules
let entries = {
app: []
};
let entries = {};
let copyImages = [];
let rules = generateBaseRules();

Expand All @@ -67,11 +66,12 @@ let rules = generateBaseRules();
*
*/
appModules.forEach(function (appModule) {
entries[appModule.name] = [];
if (appModule.js === true) {
entries.app.push(appModule.assets_path + '/js/index.js')
entries[appModule.name].push(appModule.assets_path + '/js/index.js')
}
if (appModule.styles === true) {
entries.app.push(appModule.assets_path + '/scss/index.scss')
entries[appModule.name].push(appModule.assets_path + '/scss/index.scss')
}
if (appModule.images === true) {
copyImages.push({from: appModule.assets_path + '/images', to: './images/' + appModule.name});
Expand All @@ -86,6 +86,20 @@ appModules.forEach(function (appModule) {
]
})
}
if (appModule.fonts === true) {
copyImages.push({from: appModule.assets_path + '/fonts', to: './fonts/' + appModule.name});

rules.push({
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
include: [
path.resolve(__dirname, './src/' + appModule.assets_path)
],
exclude: [/images?|img/],
use: [
{loader: 'file-loader'}
]
})
}
});

/*
Expand Down

0 comments on commit 4e54440

Please sign in to comment.