Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

common.scss file gets re-compiled/added multiple times with each successive block #295

Open
@khoallaby

Description

@khoallaby

When generating the compiled css files, ( ie both blocks.editor.build.css and blocks.style.build.css )... the compiler seems to include the common.scss file, once for every single block that is added.
this results in gigantic files, the more blocks you have

to reproduce....

  1. create a fresh install of CGB
  2. duplicate the /src/block/ folder a couple times, so there are block2, block3 folders, etc
  3. add these to the blocks.js file as usual like so
import './block/block.js';
import './block2/block.js';
import './block3/block.js';
  1. optional.. modify each block's style.scss to make sure each block's css gets pulled in once, (it does)
  2. 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

 * #.# Common SCSS
 *
 * Can include things like variables and mixins
 * that are used across the project.

 ..... this css is from the common.scss file, which gets included multiple times if there are multiple blocks loaded/compiled together
*/
body {
  background-color: white; }

/**
 * 11111
 */
.my-block1 {
  color: red; }
/**
 * #.# Common SCSS
 *
 * Can include things like variables and mixins
 * that are used across the project.

 ..... this css is from the common.scss file, which gets included multiple times if there are multiple blocks loaded/compiled together
*/
body {
  background-color: white; }

/**
 * 22222
 */
.my-block2 {
  color: blue; }
/**
 * #.# Common SCSS
 *
 * Can include things like variables and mixins
 * that are used across the project.

 ..... this css is from the common.scss file, which gets included multiple times if there are multiple blocks loaded/compiled together
*/
body {
  background-color: white; }

/**
 * 3333333
 */
.my-block3 {
  color: green; }

here is the example ive created above:
my-block.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions