sass / migrator

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

Generate import-only files for all files with removed prefixes, not just entrypoints #121

Closed jathak closed 2 years ago

jathak commented 5 years ago

I ran into this issue when trying to run material-components-web through the migrator.

Most sublibraries there consist of partials named _functions.scss, _mixins.scss, and _variables.scss and then an entrypoint named mdc-<sublibrary>..scss that, in addition to including the sublibrary's core styles, also wants to export all members from its partials.

The way to run this through the migrator is to pass the entrypoint to it with the flags --remove-prefix=mdc-<prefix>- and --forward=prefixed, which correctly forwards all of the partials through the entrypoint.

The issue is that the partials can also be depended on directly to avoid including the CSS (both by other sublibraries in material-components-web and by downstream libraries and apps), which kind of makes them "library entrypoints" from the migrator's point of view. These partials still need .import.scss files both to avoid breaking these downstream imports and to allow the migrator to run on other sublibraries that depend on this one.

I'm assuming this should be a flag, to avoid generating unnecessary .import.scss files for partials that are truly internal to a library.

@nex3: What do you think the default for this should be? (generate .import.scss for all files with removed prefixes or just entrypoints)

nex3 commented 5 years ago

I think defaulting to just generating the files for entrypoints is probably correct.