sass / migrator

Tool for migrating stylesheets to new Sass versions
MIT License
89 stars 11 forks source link

Renaming a variable with a `!global` flag crashes the migrator #81

Closed jathak closed 5 years ago

jathak commented 5 years ago

When attempting to a remove a prefix from a stylesheet like

$lib-var: red;

a {
    $lib-var: blue !global;
}

the migrator crashes, since it attempts to patch the name of the second $lib-var declaration twice.

I believe this is due to the parser adding extra VariableDeclarations to the top level of the Stylesheet to work around sass/sass#2647.

We need to detect these fake declarations and avoid visiting them (or at least avoid patching them) in the module migrator.