Roots Discourse

Applying PostCSS Plugin to only editor CSS

Hey guys!

I’m trying to apply the PostCSS plugin ‘postcss-editor-styles’ to the editor styles only, however it seems to be applying both app.css and editor.css, breaking the pages styling.

Here’s the relevant part of my buds configuration regarding this issue.

config

    .entry({
    editor: ['scripts/editor.js', 'styles/editor.css'],
    }).tap(bud => {

      bud.postcss.setPlugin('postcss-editor-styles', [
        require.resolve('postcss-editor-styles'), // the plugin module path
        {}, // options
      ])
    })
    .assets([])

    /**
     * Application entrypoints
     *
     * Paths are relative to your resources directory
     */
     .entry({
      app: ['scripts/app.js', 'styles/app.css'],
    })

Any help would be greatly appreciated

1 Like

Related:

The way you would do this is by setting up bud in a multi-compiler configuration. I don’t have time right this moment but I will post a config that can get you started as soon as I have a little extra time.

1 Like