create-caspar-graphics icon indicating copy to clipboard operation
create-caspar-graphics copied to clipboard

Allow local fonts to be omitted from webpack

Open casperwarnich opened this issue 4 years ago • 2 comments

I'd like to be able to change fonts without recompiling the templates.

Is it possible to add something like this in config/webpack.config.prod.js in caspar-graphics via a parameter in the build script?:

  {
    test: /\.(woff|woff2|eot|ttf|svg)$/,
    exclude: /node_modules/,
    loader: 'url-loader?limit=1024&name=fonts/[name].[ext]'
  }

casperwarnich avatar May 21 '21 18:05 casperwarnich

I've been thinking about exposing the entire webpack config and allow users to overwrite it (similar to what Razzle is doing: https://razzlejs.org/docs/customization#extending-webpack), but I'm worried we'll regret that in the future. How would you see this being configured?

tobiasandersen avatar May 31 '21 15:05 tobiasandersen

I'm not very skilled with custom npm packages and what the limitations are, but I was thinking one of two things: 1: caspar-graphics could check If a "webpack.config.prod.js" or "webpack.config.dev.js" file was present in either the src or root of the enduser project, and then use those instead of it's own /config folder. 2: The same as 1 but also add a tag to the build script. I.e. caspar-graphics build --customwebpack ./src/webpack.config.prod.js or something like that.

casperwarnich avatar May 31 '21 15:05 casperwarnich