3 ms·
Are there any tools that transform HTML and other files? For example, lets say I have an <img> tag with a src attribute that points to a local image. Can I auto
by sorenjan 5y ago
Are there any tools that transform HTML and other files? For example, lets say I have an <img> tag with a src attribute that points to a local image. Can I automatically replace that with a <picture> tag with various formats (jpg, webp, avif) and sizes?
- eyelidlessness 5y agoIn ESBuild you’ll need a plugin for this. The plugin API is really simple but you’ll likely be gluing other tools together to achieve it.
- darekkay 5y agoCheck out PostHTML: https://github.com/posthtml/posthtml https://github.com/posthtml/posthtml
- lioeters 5y agoRehype is an HTML processor with an ecosystem of plugins: https://github.com/rehypejs/rehype/ https://github.com/rehypejs/rehype/
- tannhaeuser 5y agoSGML can transform HTML and all other forms of markup, though it's neither limited to that use, nor does it readily bundle image converters/compressors even though that sure has always been a plausible use case for SGML-based pipelines.
- M2Ys4U 5y agoI think Parcel[0] is what you want for that use-case.[1] [0] https://parceljs.org/ https://parceljs.org/ [1] https://parceljs.org/recipes/image/ https://parceljs.org/recipes/image/