ngx-unused-css icon indicating copy to clipboard operation
ngx-unused-css copied to clipboard

@use rules must be written before any other rules.

Open nicholasconfer opened this issue 3 years ago • 1 comments

This is more of a feature request than a bug.

Today ngx-unused-css requires that @use rules are written before any other rules including @import. This creates an issue in two known situations..

  1. stylelint no-invalid-position-at-import-rule rule. This is a useful rule to ensure @import is not used improperly in the scss file
  2. Angular material theming requires @import '~@angular/material/theming'; for defining a custom theme. You would then utilize @use below it to define your custom theme files.

The reason I state this is not really a bug, and more of a request is the @import rule in general is going to become deprecated according to SASS's @import documentation.

image

At some point this means Angular material theming won't utilize @import for custom theming and the styelint check will be irrelevant. In the meantime though, to use styelint and ngx-unused-css together we need to disable the stylelint no-invalid-position-at-import-rule.

As I'd like to prepare my code for @use and @forward implementation to replace @import, it would be a nice feature to not have the @use rule throw if @import is used before it.

nicholasconfer avatar May 10 '21 15:05 nicholasconfer

agreed this is not working with Angular Material 14 due to @use

paulchill avatar Feb 18 '23 11:02 paulchill