danielguillan / bem-constructor

A Sass library for building immutable and namespaced BEM CSS objects
MIT License
541 stars 32 forks source link

Dart Sass Compatibility #28

Open vish288 opened 5 years ago

vish288 commented 5 years ago

I work on a project which recently migrated from node-sass to dart-sass for compilation and dart-sass doesn't like usage of !global and so there are warnings that prop up for using bem-constructor as follows.

DEPRECATION WARNING: As of Dart Sass 2.0.0, !global assignments won't be able to
declare new variables. Consider adding `$_bem-log: null` at the top level.

   ╷
27 │ $_bem-log: () !global;
   │ ^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/sass-bem-constructor/dist/_sass-bem-constructor.scss 27:1  @import
    src/client/scss/_import.scss 7:9                                   @import
    stdin 1:9                                                               root stylesheet

DEPRECATION WARNING: As of Dart Sass 2.0.0, !global assignments won't be able to
declare new variables. Consider adding `$_bem-current-context: null` at the top level.

   ╷
40 │ $_bem-current-context: () !global;
   │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/sass-bem-constructor/dist/_sass-bem-constructor.scss 40:1  @import
    src/client/scss/_import.scss 7:9                                   @import
    stdin 1:9                                                               root stylesheet

since the constructor is imported by every module as part of the base setup. This warning shows up twice per module in the project. ( so a looooottttt 🤕 ). Suggestions on fixing this would be welcome. I can submit an updated PR to replace them with null if that would solve the issue and make this repo in compliance with dart-sass.

danielguillan commented 5 years ago

Thanks for reporting the issue, @vish1988!

I'll be happy to accept a PR that removes the warnings in dart-sass, as long as it maintains support for older versions of Libsass and Ruby Sass.