sass / migrator

Tool for migrating stylesheets to new Sass versions
MIT License
84 stars 10 forks source link

Properly support changing paths through an import-only file #160

Closed jathak closed 3 years ago

jathak commented 4 years ago

Right now, the module migrator always includes a @use and/or @forward rule with the exact URL of each @import rule, even if that URL has an import-only file that doesn't forward the regular file.

e.g.

<==> entrypoint.scss
@import "old";

a { b: $lib-variable; }

<==> _old.scss
@error "Use 'new'";

<==> _old.import.scss
@forward "new" as lib-*;

<==> _new.scss
$variable: blue;

Right now, the entrypoint would be migrated to:

@use "old";
@use "new";

a { b: new.$variable }

While a @use rule with a new URL is added, and the namespacing is correct, the @import "old"; is also migrated to a @use, which is wrong, since the import-only file for old old forwards new.