Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

@import in css doesn't apply cascade layer to media queries #23806

Closed
2 of 15 tasks
Th3S4mur41 opened this issue Aug 26, 2022 · 2 comments
Closed
2 of 15 tasks

@import in css doesn't apply cascade layer to media queries #23806

Th3S4mur41 opened this issue Aug 26, 2022 · 2 comments

Comments

@Th3S4mur41
Copy link

馃悶 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

I don't think so

Description

A clear and concise description of the problem...

@import url('external.css') layer(external); should behave exactly the same as

@layer internal {
 some CSS
}

As seeen in this codepen

When Angular processes the import to include it in the main css file though, it doesn't put the @media queries from the external.css in the @layer external block.

馃敩 Minimal Reproduction

Consider *main.css being the angular app's main css file and external.css a CSS file imported from an external package.

/* external.css */
@media (prefers-color-scheme: dark) {
  .import {
    background: darkgray;
  }
}
[data-theme="import-dark"] {
  background: black;
  color: white;
}
/* main.css */
@import url('external.css') layer(external);

Compiling the angular app should result in the following CSS:

/* expected-output.css */
@layer external {
  @media (prefers-color-scheme: dark) {
    .import {
      background: darkgray;
    }
  }
  [data-theme="import-dark"] {
    background: black;
    color: white;
  }
}

The actual output however is the following:

/* wrong-output.css */
@media (prefers-color-scheme: dark) {
  .import {
    background: darkgray;
  }
}
@layer external {
  [data-theme="import-dark"] {
    background: black;
    color: white;
  }
}
@alan-agius4
Copy link
Collaborator

Hi @Th3S4mur41,

Thanks for reporting this. However, this is not actionable from our end since this is a bug in postcss-import.

See: postcss/postcss-import#495

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants