metalsmith-image-dimensions
Metalsmith plugin for automatically adding width
and height
attributes to img
tags.
Example
Input:
Output:
Usage
const mediaMetadata = ;const imageDimensions = ; metalsmith ;
metalsmith-dom-transform
Using with If you're already using metalsmith-dom-transform
, you can save a little bit of overhead by accessing the image dimension transform directly:
const domTransform = ;const imageDimensionsTransform = ; metalsmith;
Requirements
Notes
- External images are not supported since I didn't need them. File an issue if that's something you'd like.
Configuration
domain
: Domain where this is hosted, used to determine if an image is external. It is unlikely that you'd need to set this, unless you have absolute URLs for image that are local to the site (default:http://example.com
).overwrite
: Writewidth
andheight
tags even if already set (defaultfalse
)
Changelog
0.0.1
: First release