SassNinja/media-query-plugin

Not possible to extract media queries from all css files

karolisgrinkevicius-home24 opened this issue · 4 comments

Hi. Thanks for this really handy plugin.

Afaiu currently it's not possible to extract media queries from all the files in the project, i.e. main bundle which is for instance myapp.css. It would be really nice if I ignore include option all the css files are gathered. Is it possible with current implementation of this plugin? mike-diamond/media-query-splitting-plugin does support this yet since it has some limitations it doesn't fit for my needs.

Thanks!

Hi @karolisgrinkevicius-home24

I'm glad to hear you're preferring my plugin :)
(github star is appreciated)

Is it possible with current implementation of this plugin?

yes it is!
you just need to set include: true in the options to affect all chunks

Hi @SassNinja and thanks for your response! I already tried to set include: true and it partially works in my case but here's another question then: how to bundle all the gathered css into main entry css file avoiding usage of groups option? As of now I hardcoded all scss files in groups as following:

{
  groups: {
    'app-entry': ['app', 'main', 'testComponent', 'testComponent2'],
  }
}

Hopefully you figured out what I'm trying to say 😄

and it partially works in my case

what is not working? (since you said 'partially')
you wanted to affect the CSS chunks without explicitly naming each chunk and that's exactly what include: true does

how to bundle all the gathered css into main entry css file avoiding usage of groups option?

That's not possible yet because groups only supports arrays.
But I'll add regex support to it once I've got some free time. Afterwards you can do the following:

{
  groups: {
    'app-entry': /.*/
  }
}

There's already an issue for it:
#11

what is not working? (since you said 'partially')
you wanted to affect the CSS chunks without explicitly naming each chunk and that's exactly what include: true does

I didn’t mean particularly include, it works just well.

That's not possible yet because groups only supports arrays.
But I'll add regex support to it once I've got some free time. Afterwards you can do the following...

That’s what I meant. It’d be awesome to have regex feature on groups. Will eagerly wait for this feature.