@hashicorp/hashi-image
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -30,2 +30,5 @@ 'use strict'; | ||
// handle aspect ratios passed as a string | ||
aspect_ratio = typeof aspect_ratio === 'string' ? aspect_ratio.split(',').map(Number) : aspect_ratio; | ||
if (svg && svg !== 'false') { | ||
@@ -38,3 +41,3 @@ // if it's an SVG, we don't need the picture element, so return | ||
var srcDefault = formatSteps(steps, opts, aspect_ratio, src); | ||
var srcWebp = formatSteps(steps, assign(opts, { fm: 'webp' }), aspect_ratio, src); | ||
var srcWebp = formatSteps(steps, assign({}, opts, { fm: 'webp' }), aspect_ratio, src); | ||
@@ -41,0 +44,0 @@ return preact.h( |
{ | ||
"name": "@hashicorp/hashi-image", | ||
"description": "super optimized image element, pulls from dato and formats for 7 screen sizes in two formats. Skips optimization for SVGs.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "dist", | ||
@@ -6,0 +6,0 @@ "peerDependencies": { |
@@ -13,3 +13,3 @@ ### Image | ||
* `alt` (str): [optional] alt text for the image [docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-alt) | ||
* `aspect_ratio` (arr): [optional] automatically crops to aspect ratio. first two items in the array are the ratio (ex. `[16,9]`), and the third is the base width that images will be cropped to in IE, which doesn't support srcset (ex. `[16,9,500]`) | ||
* `aspect_ratio` (arr or str): [optional] automatically crops to aspect ratio. first two items in the array are the ratio (ex. `[16,9]`), and the third is the base width that images will be cropped to in IE, which doesn't support srcset (ex. `[16,9,500]`). if string is provided, brackets should be excluded (ex. `16,9,500`). string will be converted to array | ||
* `params` (obj): [optional] params passed directly to imgix | ||
@@ -16,0 +16,0 @@ |
3913
60