Skip to content

Instantly share code, notes, and snippets.

@andreypelykh
Last active September 2, 2022 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreypelykh/9e1d36f813a2501be11faa92014758ab to your computer and use it in GitHub Desktop.
Save andreypelykh/9e1d36f813a2501be11faa92014758ab to your computer and use it in GitHub Desktop.
Webpack config exports a function
module.exports = function (config) {
// Your existing rules (example)
config.module.rules.push(
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
options: {
// `style-loader` options here...
}
}
]
}
);
// CKEditor rules from the docs
// https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/quick-start-other.html#building-the-editor-from-source
config.module.rules.push(
{
test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: ['raw-loader'],
},
{
test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
use: [
{
loader: 'style-loader',
options: {
injectType: 'singletonStyleTag',
attributes: {
'data-cke': true,
},
},
},
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: styles.getPostCssConfig({
themeImporter: {
themePath: require.resolve('@ckeditor/ckeditor5-theme-lark'),
},
minify: false,
}),
},
},
],
}
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment