eleventy-plugin-images-responsiver
Advanced tools
Comparing version
'use strict'; | ||
const imagesResponsiver = require('images-responsiver'); | ||
import pkg from './package.json' with { type: 'json' }; | ||
module.exports = (eleventyConfig, options = {}) => { | ||
import imagesResponsiver from 'images-responsiver'; | ||
export default async (eleventyConfig, userOptions = {}) => { | ||
// First check if the plugin is used with a compatible version of Eleventy | ||
try { | ||
eleventyConfig.versionCheck(pkg['11ty'].compatibility); | ||
} catch (e) { | ||
console.error( | ||
`[eleventy-plugin-image-responsiver] Plugin compatibility error ${e.message}` | ||
); | ||
return; | ||
} | ||
eleventyConfig.addTransform('imagesResponsiver', function (content) { | ||
if (this.page.outputPath && this.page.outputPath.endsWith('.html')) { | ||
return imagesResponsiver(content, options, this.page.url); | ||
return imagesResponsiver(content, userOptions, this.page.url); | ||
} | ||
@@ -10,0 +22,0 @@ return content; |
{ | ||
"name": "eleventy-plugin-images-responsiver", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"description": "Global solution for responsive images in Eleventy, allowing authors to use Markdown syntax for image and yet get responsive images in generated HTML.", | ||
@@ -10,8 +10,9 @@ "main": "eleventy-plugin-images-responsiver.js", | ||
}, | ||
"files": [ | ||
"./" | ||
], | ||
"files": [], | ||
"type": "module", | ||
"scripts": { | ||
"lint": "eslint . --ext js --quiet --fix", | ||
"prepare": "husky install" | ||
"test": "echo \"No test specified yet\"", | ||
"prepare": "node .husky/install.mjs", | ||
"release": "np" | ||
}, | ||
@@ -39,5 +40,2 @@ "keywords": [ | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@11ty/eleventy": "^2.0.0" | ||
}, | ||
"dependencies": { | ||
@@ -47,8 +45,9 @@ "images-responsiver": "^1.13.0" | ||
"devDependencies": { | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^13.2.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"husky": "^7.0.4" | ||
"@commitlint/cli": "^19.5.0", | ||
"@commitlint/config-conventional": "^19.5.0", | ||
"eslint": "^9.13.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.2.1", | ||
"husky": "^9.1.6", | ||
"np": "^10.0.7" | ||
}, | ||
@@ -59,3 +58,6 @@ "bugs": { | ||
"homepage": "https://nhoizey.github.io/eleventy-plugin-images-responsiver/", | ||
"gitHead": "e59f7fb0422676b8928998b5233c4824ed695c10" | ||
"gitHead": "e59f7fb0422676b8928998b5233c4824ed695c10", | ||
"11ty": { | ||
"compatibility": ">=3 <4" | ||
} | ||
} |
# eleventy-plugin-images-responsiver | ||
[](https://github.com/nhoizey/eleventy-plugin-images-responsiver/actions) | ||
[](https://github.com/nhoizey/eleventy-plugin-images-responsiver/stargazers) | ||
[](https://github.com/nhoizey/eleventy-plugin-images-responsiver/blob/main/LICENSE.md) | ||
[](<>) | ||
[](https://www.npmjs.com/package/eleventy-plugin-images-responsiver) | ||
[](https://github.com/nhoizey/eleventy-plugin-images-responsiver/stargazers) | ||
[](https://mamot.fr/@nhoizey) | ||
@@ -7,0 +8,0 @@ `eleventy-plugin-images-responsiver` is **a simple solution for most responsive images needs with [Eleventy](https://www.11ty.dev/)**. |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
9743
7.27%1
-50%20
100%96
1.05%0
-100%Yes
NaN7
16.67%1
Infinity%