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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular compatibility #29

Closed
alixroyere opened this issue Jun 10, 2022 · 1 comment
Closed

Angular compatibility #29

alixroyere opened this issue Jun 10, 2022 · 1 comment

Comments

@alixroyere
Copy link

alixroyere commented Jun 10, 2022

In angular projects, there is an angular.json file, where we can define a list of style sheets to import in the app (see https://angular.io/guide/workspace-config#additional-build-and-test-options). Then, the css variables defined in these root sheets don't necessary need to be imported via @import to be available in others css files.

In the pluggin, with the configuration property importFrom: ["/my-css.css"], the declared file seems to be used only when @import my-css.css is present in the file where the variable is used. So all the usages of my variables are in error, when they shouldn't, as they are declared in a root file.

Is there a way to add a new stylelint configuration property of style file paths, as importFrom one, used by the pluggin to search for variable declarations even if there is no @import statement in the file containing the variable usages?

Examples:
my-root-style.css

:root {
  --green: green;
}

my-other-style.css

body {
  color: var(--green);
}

This should be valid with a stylelint config file containing :

 rules: {
    "csstools/value-no-unknown-custom-properties": [
      true,
      {
        injectFrom: ["/my-root-style.scss"],
      },
    ],
  },

And this should still be invalid with a stylelint config file containing :

 rules: {
    "csstools/value-no-unknown-custom-properties": [
      true,
      {
        importFrom: ["/my-root-style.scss"],
      },
    ],
  },

or

 rules: {
    "csstools/value-no-unknown-custom-properties": [
      true
    ],
  },
@romainmenke
Copy link
Member

This is beyond the scope of this rule.
There are hundreds of frameworks, metaframeworks, ... and we can not add provisions for each of those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants