Closed jathak closed 5 years ago
Would something like this be acceptable?
<==> input/entrypoint.scss
@import "direct";
a {
color: $variable;
}
<==> input/_direct.scss
@import "~module/indirect";
<==> input/node_modules/module/_indirect.scss
$variable: green;
<==> output/entrypoint.scss
@use "node_modules/module/indirect";
@use "direct";
a {
color: indirect.$variable;
}
<==> output/_direct.scss
@use "~module/indirect";
I could change _absoluteUrlToDependency
to add ~
URLs as one of its options, but would we want to generate those URLs even for users that weren't already using them?
I don't love either of those options... could you track the original URLs for stylesheets and re-use them if they came from load paths or the Webpack importer?
Okay, I think that should be doable. For detecting whether the original URL was resolved by the Webpack importer, I can just check whether the importer returned by ImportCache.import
was the NodeModulesImporter
, but I'm not sure how best to detect a relative import vs one from a load path.
I'm going to merge this now. I opened #90 to use the original URLs for imports from load paths.
Fixes #58. Fixes #68.
This adds the
--load-path
option to the executable and also implements an approximation of the Webpack~
syntax that resolves these URLs to stylesheets withinnode_modules
directories that should be good enough to run the migrator with for most cases.Wait to merge until after #76