Tuleap 16 est là ! Assistez à l'événement virtuel le 17 octobre à 10h30. Inscrivez-vous ici !

    •  
      request #39350 Use sass NodePackageImporter
    Infos
    #39350
    Joris MASSON (jmasson)
    2024-09-06 09:48
    2024-09-03 10:39
    40962
    Details
    Use sass NodePackageImporter

    Starting from sass v1.71.0, Sass offers an API called NodePackageImporter to resolve .scss files. For all stylesheets coming from an NPM package, we must use the pkg: prefix to load it. For example pkg:@tuleap/tlp-modal. It has several advantages over the current situation of the default Sass importer:

    1. It relies on Node resolution and respects exports field in package.json. This will let us define explicitly which .css or .scss file can be imported by consumers of a given package. This makes the dependencies between our packages more explicit. It lets us drop the "default": <path> rules in exports in favor of "sass" rules. It also lets us drop (in most cases) the special "./style": <path> in exports, because now Sass can understand that we mean to import a stylesheet. It also lets us drop the "style": <path> fields in package.json, we replace it in favor of a single system with exports.
    2. It moves the file resolution from vite and webpack to Sass. This means more interoperability and fewer "special cases" in our build system.
    3. It is a bit stricter. When making the change, I had to change some relative paths (../../../) to pkg paths. It will help us eliminate more hidden cross-package dependencies.
    Dev tools
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Joris MASSON (jmasson)
    Closed
    2024-09-06
    Attachments
    Empty
    References
    Referencing request #39350

    Follow-ups