-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
feat(rollup-plugin-html): resolves assets in styles #2664
feat(rollup-plugin-html): resolves assets in styles #2664
Conversation
🦋 Changeset detectedLatest commit: c3dc21a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
79dd835
to
ea299d2
Compare
ea299d2
to
47728ce
Compare
dc24a9d
to
57c2923
Compare
57c2923
to
549eaf7
Compare
code: asset.content, | ||
minify: false, | ||
visitor: { | ||
Url: url => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this recursively follow all css files includes (the @import
ones)?
if yes, looks like source = Buffer.from(code);
would not update anything but the entry point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code as currently implemented does not bundle css via @import
. I looked at both esbuild and lightningcss, and they have a bundle
for css, but it only follows @import
, and not url
, which is what we need. So for now I only added support for assets referenced via url
, afaik you can't add .css files in url
. In the future we could consider bundling imported css
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear, makes sense!
packages/rollup-plugin-html/test/fixtures/resolves-assets-in-styles-images/styles.css
Outdated
Show resolved
Hide resolved
/.*\.avif/, | ||
/.*\.woff2/, | ||
/.*\.woff/, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you want to use the allowed extensions list? are there some extensions that should not be handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not really sure what people may add in url
, so I figured be on the safe side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with current approach we'll need to maintain a list of extensions and update when new types appear or if we forgot to include smth
instead I'd rather prefer to have a blocklist
and make it configurable, we can do that later too
super nice work Pascal!
|
@bashmish im gonna go ahead and merge this (it will take some time to end up in our internal npm feed as well, and i'd really like to wrap this up today), the other things we can do in another iteration/separate PR |
What I did