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

Support refactoring out an intermediate dependency #161

Open
jathak opened this issue Sep 3, 2020 · 0 comments
Open

Support refactoring out an intermediate dependency #161

jathak opened this issue Sep 3, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@jathak
Copy link
Member

jathak commented Sep 3, 2020

Assume a case where you have a set of files like:

<==> entrypoint.scss
@use "indirect";

a {
  color: indirect.$a-color;
  background: indirect.$b-color;
}

<==> _indirect.scss
@forward "a" as a-*;
@forward "b" as b-*;

<==> _a.scss
$color: red;

<==> _b.scss
$color: blue;

It would be nice to have a migrator that would let you refactor entrypoint.scss to directly depend on a and b instead of going through indirect, e.g.:

<==> entrypoint.scss
@use "a";
@use "b";

a {
  color: a.$color;
  background: b.$color;
}

The motivating use case here would be to get rid of use rules like @use "library.import", which we've been using as a temporary workaround when migrating an library that already has downstream users using @use. However, the generalized version could be useful for other refactoring.

To ease implementation, this should only support code that has already migrated to the module system, since that should make it possible to implement without fully analyzing the entire dependency graph.

@jathak jathak added the enhancement New feature or request label Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant