-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Parcel 2: Image Resizing Transformer #3737
Labels
Comments
This was referenced Nov 3, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create the
@parcel/transformer-image-resize
package. This should include a Transformer plugin that resizes images using the sharp library. It should accept options via query parameters to determine what size to resize the image to.For example, you could reference an image like this to resize it to 200px wide:
This would also work anywhere images can be referenced, e.g. CSS or JS.
This transformer should be included in
@parcel/config-default
in a pipeline for*.{png,jpg,jpeg}
. However, in order to improve development build performance, it should only run in production mode. This should be safe as long as users are using explicit sizes on their image tags in addition to their URLs. Also, if no query params are provided to the image url, the plugin should do nothing.The text was updated successfully, but these errors were encountered: