Hi guys
I found a trick to include the front style in Gutenberg editor :
- Copy the style from your
app.cssfile to theeditor.cssfile (with a simple configuration, an @import should be enough). In my case I use tailwind, I copy/paste the whole file with all imports. - Add the
postcss-prefixwrapplugin. Use eitherpostcss.config.js(tested) orbud.config.js(not tested). Set.editor-styles-wrapperas prefix. - Make sure that the plugin is only executed on the
editor.cssfile : frompostcss.config.js, just check if the name of the processed file contains editor.css.
Ex:
module.exports = (api) => {
return {
ident: 'postcss',
plugins: getPlugins(api.file.includes('/editor.css')),
};
};
- Disable the default editor’s styles
add_action('after_setup_theme', function () {
remove_editor_styles();
}, 999);
And it’s done !