Open khoallaby opened 3 years ago
you can actually see the same thing happening in your examples as well: https://github.com/ahmadawais/create-guten-block/blob/b8fbdbcf2f1b9db4918eb933d630777027ed3de8/examples/03-multi-block/dist/blocks.style.build.css
notice the duplicated #.# Common SCSS
comments that occur over and over
up, same issue :))
I found a temporary solution to this problem.
editor.scss
(styles for backend editor), style.scss
(styles for frontend+backend editor), index.js
(only include import scss file).Now in the file common.scss
should only leave variables, mixins. All styles in common.scss
file should be moved into styles/style.scss
file. You can override styles in the backend editor by writing styles/editor.scss
file.
It's done!
When generating the compiled css files, ( ie both
blocks.editor.build.css
andblocks.style.build.css
)... the compiler seems to include thecommon.scss
file, once for every single block that is added. this results in gigantic files, the more blocks you haveto reproduce....
create a fresh install of CGB
duplicate the /src/block/ folder a couple times, so there are
block2
,block3
folders, etcadd these to the
blocks.js
file as usual like sooptional.. modify each block's style.scss to make sure each block's css gets pulled in once, (it does)
run compiler, and check the compiled css in
dist/*.css
example output of
blocks.style.build.css
notice how the individual block's style.scss files are included once (which is expected).... but for EVERY block, the common.scss file is included AGAIN, instead of just ONCE overall
here is the example ive created above: my-block.zip