{"name":"postcss-image-set-function","version":"4.0.4","description":"Display resolution-dependent images using the image-set() function in CSS","author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"CC0-1.0","homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-image-set-function#readme","bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"main":"dist/index.cjs","module":"dist/index.mjs","types":"dist/index.d.ts","scripts":{"build":"rollup -c ../../rollup/default.js","clean":"node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"","lint":"eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern","prepublishOnly":"npm run clean && npm run build && npm run test","stryker":"stryker run --logLevel error","test":"postcss-tape --ci && npm run test:exports","test:exports":"node ./test/_import.mjs && node ./test/_require.cjs"},"engines":{"node":"^12 || ^14 || >=16"},"dependencies":{"postcss-value-parser":"^4.2.0"},"devDependencies":{"postcss":"^8.3.6","postcss-tape":"^6.0.1"},"peerDependencies":{"postcss":"^8.3"},"keywords":["postcss","css","postcss-plugin","image-set","background","image","responsive","resolution","negotiation","optimization"],"repository":{"type":"git","url":"git+https://github.com/csstools/postcss-plugins.git","directory":"plugins/postcss-image-set-function"},"volta":{"extends":"../../package.json"},"gitHead":"ad644da77a0bde288a85e49d9750f24a2f077f9b","_id":"postcss-image-set-function@4.0.4","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-BlEo9gSTj66lXjRNByvkMK9dEdEGFXRfGjKRi9fo8s0/P3oEk74cAoonl/utiM50E2OPVb/XSu+lWvdW4KtE/Q==","shasum":"ce91579ab2c1386d412ff5cd5e733c474b1f75ee","tarball":"http://registry-npm.ywwl.com/postcss-image-set-function/download/postcss-image-set-function-4.0.4.tgz","fileCount":12,"unpackedSize":21422,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh0cXqCRA9TVsSAnZWagAABiQQAJMhem8ifiejUgm7uFLz\nkWmWIiOQLo/dxFTs9PAY8HKutjCA12XkFCep24Lw3X/HvVYu9lIwNjoJBRam\nmKmViKPs3dYb7t02kTn5LyxcMWHoLB4SjWIzz3oi4EEY/u+9ZE5d7rHHtT0/\n9lilIW7nso6sdE8mS/ELs+du5jY/GBGGkgfVK5104tag2rsxucNr+UUzt4z2\ny+RCWK3PqyhjYp+gPCrsT6/PrkfG46/Ne9MH5iiPYNUUvtfpiinb1O9cPfy9\njYIca6e0dFbA67oVvFG3Y03kA7BYCRkzjBqcgSBn7n5bxrXxynrBJw6tqmQU\nYsaMs0/7WQBFJTeH3R8+uV8SvLNgGUr0Fh44UQDBdmLqzpcKQDWrElHvU2W0\nV0nv9jekV8NpviVmf28Juxp5MOcXmT3jkDd4UaZEJ0lKVXGU6tf/lgI6sFbf\nNxMSjVtoWYEd8Ky9tHPUEzexlVxsyoDo2BquBNL7YzUNKPpI+7cFJfmEnkQx\nBZpOzlQ3Mc1OWSUw8H+khZnVpojS8DdmL2bJodcJMMWhQb6aK606GTSdODWv\nTxpZyba0Hy0PT3yxGcEB1PAfBl4m4fGj3LD9cGOxu5e0116KIDn/lvP7LiI2\n5Ei1CKxAI05biTpTOm6j46IHGpZuVbAhQjvzKe0uCoq4t+CHSyMSjBYYmMIf\n5Cie\r\n=9Jfi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtwqAYjwH3Kan+vIDklhzP/0Xe28fVrieuUKYi84ZwkgIhAI41161oQDafZNxPADWJIiPdsBKzqZSNGrLKgMUcj1bG"}],"size":7804,"noattachment":false,"key":"/postcss-image-set-function/-/postcss-image-set-function-4.0.4.tgz"},"_npmUser":{"name":"alaguna","email":"sombragriselros@gmail.com"},"directories":{},"maintainers":[{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postcss-image-set-function_4.0.4_1641137642579_0.8802788578555976"},"_hasShrinkwrap":false,"readme":"# PostCSS image-set() Function [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\">][postcss]\n\n[![NPM Version][npm-img]][npm-url]\n[![Build Status][cli-img]][cli-url]\n[<img alt=\"Discord\" src=\"https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white\">][discord]\n<br><br>\n[<img alt=\"Baseline Status\" src=\"https://cssdb.org/images/badges-baseline/image-set-function.svg\" height=\"20\">][css-url]\n[![CSS Standard Status][css-img]][css-url]\n\n[PostCSS image-set() Function] lets you display resolution-dependent images\nusing the `image-set()` function in CSS, following the [CSS Images]\nspecification.\n\n[!['Can I use' table](https://caniuse.bitsofco.de/image/css-image-set.png)](https://caniuse.com/#feat=css-image-set)\n\n```pcss\n.example {\n  background-image: image-set(\n    url(img.png) 1x,\n    url(img@2x.png) 2x,\n    url(img@print.png) 600dpi\n  );\n}\n\n/* becomes */\n\n.example {\n  background-image: url(img.png);\n}\n\n@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {\n  .example {\n    background-image: url(img@2x.png);\n  }\n}\n\n\n@media (-webkit-min-device-pixel-ratio: 6.25), (min-resolution: 600dpi) {\n  .example {\n    background-image: url(my@print.png);\n  }\n}\n\n.example {\n  background-image: image-set(\n    url(img.png) 1x,\n    url(img@2x.png) 2x,\n    url(img@print.png) 600dpi\n  );\n}\n```\n\n## Usage\n\nAdd [PostCSS image-set() Function] to your project:\n\n```bash\nnpm install postcss-image-set-function --save-dev\n```\n\nUse [PostCSS image-set() Function] as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssImageSetFunction = require('postcss-image-set-function');\n\npostcss([\n  postcssImageSetFunction(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n[PostCSS image-set() Function] runs in all Node environments, with special\ninstructions for:\n\n| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |\n| --- | --- | --- | --- | --- |\n\n## Options\n\n### preserve\n\nThe `preserve` option determines whether the original declaration using\n`image-set()` is preserved. By default, it is preserved.\n\n```js\npostcssImageSetFunction({ preserve: false })\n```\n\n```pcss\n.example {\n  background-image: image-set(\n    url(img.png) 1x,\n    url(img@2x.png) 2x,\n    url(img@print.png) 600dpi\n  );\n}\n\n/* becomes */\n\n@media (-webkit-min-device-pixel-ratio: 1), (min-resolution: 96dpi) {\n  .example {\n    background-image: url(img.png);\n  }\n}\n\n@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {\n  .example {\n    background-image: url(img@2x.png);\n  }\n}\n\n\n@media (-webkit-min-device-pixel-ratio: 6.25), (min-resolution: 600dpi) {\n  .example {\n    background-image: url(my@print.png);\n  }\n}\n```\n\n### onInvalid\n\nThe `onInvalid` option determines how invalid usage of `image-set()` should be\nhandled. By default, invalid usages of `image-set()` are ignored.\nThey can be configured to emit a warning with `warn` or throw an exception with `throw`.\n\n```js\npostcssImageSetFunction({ onInvalid: 'warn' }) // warn on invalid usages\n```\n\n```js\npostcssImageSetFunction({ onInvalid: 'throw' }) // throw on invalid usages\n```\n\n## Image Resolution\n\nThe `image-set()` function allows an author to provide multiple resolutions of\nan image and let the browser decide which is most appropriate in a given\nsituation. The `image-set()` also never fails to choose an image; the\n`<resolution>` just helps determine which of the images is chosen.\n\nSince this plugin is not a browser, the image options are sorted by device\npixel ratio and the lowest ratio is used as the default, while the remaining\nimages are pushed behind media queries.\n\nTherefore, this plugin can only approximate native browser behavior. While\nimages should typically match the resolution as the device they’re being viewed\nin, other factors can affect the chosen image. For example, if the user is on a\nslow mobile connection, the browser may prefer to select a lower-res image\nrather than wait for a larger, resolution-matching image to load.\n\n[cli-img]: https://github.com/csstools/postcss-plugins/workflows/test/badge.svg\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-img]: https://cssdb.org/images/badges/image-set-function.svg\n[css-url]: https://cssdb.org/#image-set-function\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-img]: https://img.shields.io/npm/v/postcss-image-set-function.svg\n[npm-url]: https://www.npmjs.com/package/postcss-image-set-function\n\n[CSS Images]: https://drafts.csswg.org/css-images-4/#image-set-notation\n[Gulp PostCSS]: https://github.com/postcss/gulp-postcss\n[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Loader]: https://github.com/postcss/postcss-loader\n[PostCSS image-set() Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-image-set-function\n","publish_time":1641137642714,"_cnpm_publish_time":1641137642714,"dist-tags":{"latest":"8.0.2"}}