Skip to content

Allow option to suppress @import after other CSS warning #426

@K3TH3R

Description

@K3TH3R

I'm working on a new Nuxt.js website right now that uses @nuxtjs/style-resources to automatically inject a _variables.pcss file into each Vue component's <style> instance. This allows me to avoid doing this in every component:

<style type="postcss">
  @import '~/styles/_variables.pcss';

  /* actual component styles */
</style>

However, postcss-import is refusing to import anything in my global style file:

@import './lib/_variables.pcss';
@import './lib/_globals.pcss';
@import './lib/_type.pcss';

This is, essentially, because that style-resources plugin is automatically injecting the variables into the top of the file prior to the @import statements being processed.

My suggestion is to add a property to the options object like suppressWarning which is false by default and if true, allows us to bypass the warnings added in #240. I can put together a PR if this sounds like a reasonable idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions