Production Build Script Removing Editor Styles for Gutenberg Blocks

I have all my blocks living in ./assets/scripts/blocks/block-name/ I import my editor.scss file into my index.js at the root directory for each block.

Example:
./assets/scripts/blocks/call-to-action/index.js
imports ./assets/scripts/blocks/call-to-action/editor.scss at the top.

When running build, it inlines them just fine and display proper styles in the editor. When I run build:production, it seems to remove all inline-styles.

I’m not really sure how to fix this? I’ve tried adding purge css flags on the editor files with no luck, even though as far as I can tell, my editor.scss for the blocks doesn’t run through purgeCSS at all, only though mix.js

So for now, I am registering each editor style and importing via php when registering the block. Would love to know if there is a setting I’m missing with laravel mix that doesn’t strip styles out of JS files.

Do they get extracted to dist/styles/blocks.css if you use:

mix.options({
  extractVueStyles: 'styles/blocks.css',
});

This topic was automatically closed after 42 days. New replies are no longer allowed.