embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
329 stars 137 forks source link

add vite compat styles resolver #1854

Open patricklx opened 1 month ago

patricklx commented 1 month ago

There are.scss or .less files in some v1 addons, which currently can only be consumed because they are copied to rewritten-app/assets.

But i could now do something like this in vite:

// my-app/app.scss
@use 'my-v1-addon'

And have app.js import app.scss

ef4 commented 1 month ago

Discussed this together in office hours.

This is implementing a feature that might be useful for people who are ready to completely opt out of the classic style pipeline. But it doesn't mix well with that pipeline.

Today, sass from v1 addons does work in the classic app/styles/app.scss and gets handled entirely in the broccoli-based prebuild for compatibility. This is different from configuring vite to directly build sass, which does not have access to sass from v1 addons.

An @embroider/sass plugin that uses embroider's resolver to locate files in classic addons would be a potentially useful new addition, but would be mutually exclusive with the use of @embroider/synthesized-vendor.

mansona commented 2 weeks ago

I'm marking this as "waiting for contributor" since @ef4 laid out a way forward and this PR would need extra work before we could consider merging 👍