postcss-image-set-function
Advanced tools
Comparing version 4.0.7 to 5.0.0
# Changes to PostCSS image-set() Function | ||
### 5.0.0 (January 24, 2023) | ||
- Updated: Support for Node v14+ (major). | ||
- Changed: `oninvalid` plugin option to `onInvalid` to match other plugins with similar options (breaking). | ||
### 4.0.7 (July 8, 2022) | ||
@@ -4,0 +9,0 @@ |
import type { PluginCreator } from 'postcss'; | ||
declare const creator: PluginCreator<{ | ||
preserve: boolean; | ||
oninvalid: string; | ||
}>; | ||
/** postcss-image-set-function plugin options */ | ||
export type pluginOptions = { | ||
/** Preserve the original notation. default: true */ | ||
preserve?: boolean; | ||
/** | ||
* Determine how invalid usage of `image-set()` should be handled. | ||
* By default, invalid usages of `image-set()` are ignored. | ||
* They can be configured to emit a warning with `warn` or throw an exception with `throw`. | ||
* default: 'ignore' | ||
*/ | ||
onInvalid?: 'warn' | 'throw' | 'ignore' | false; | ||
}; | ||
declare const creator: PluginCreator<pluginOptions>; | ||
export default creator; |
import type { Declaration, Result, Postcss } from 'postcss'; | ||
import type { Node } from 'postcss-value-parser'; | ||
declare type imageSetFunction = { | ||
type imageSetFunction = { | ||
imageSetFunction: Node; | ||
@@ -9,3 +9,3 @@ imageSetOptionNodes: Array<Node>; | ||
decl: Declaration; | ||
oninvalid: string; | ||
oninvalid: 'warn' | 'throw' | 'ignore' | false; | ||
preserve: boolean; | ||
@@ -12,0 +12,0 @@ result: Result; |
{ | ||
"name": "postcss-image-set-function", | ||
"description": "Display resolution-dependent images using the image-set() function in CSS", | ||
"version": "4.0.7", | ||
"version": "5.0.0", | ||
"author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
@@ -12,3 +12,3 @@ "license": "CC0-1.0", | ||
"engines": { | ||
"node": "^12 || ^14 || >=16" | ||
"node": "^14 || ^16 || >=18" | ||
}, | ||
@@ -35,7 +35,8 @@ "main": "dist/index.cjs", | ||
"peerDependencies": { | ||
"postcss": "^8.2" | ||
"postcss": "^8.4" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c ../../rollup/default.js", | ||
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"", | ||
"prebuild": "npm run clean", | ||
"build": "rollup -c ../../rollup/default.mjs", | ||
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"", | ||
"docs": "node ../../.github/bin/generate-docs/install.mjs", | ||
@@ -42,0 +43,0 @@ "lint": "npm run lint:eslint && npm run lint:package-json", |
@@ -73,4 +73,4 @@ # PostCSS image-set() Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss] | ||
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) | | ||
| --- | --- | --- | --- | --- | --- | | ||
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) | | ||
| --- | --- | --- | --- | --- | | ||
@@ -119,14 +119,14 @@ ## Options | ||
### onvalid | ||
### onInvalid | ||
The `oninvalid` option determines how invalid usage of `image-set()` should be | ||
handled. By default, invalid usages of `image-set()` are ignored. They can be | ||
configured to display a `warning` or `throw` an error. | ||
The `onInvalid` option determines how invalid usage of `image-set()` should be | ||
handled. By default, invalid usages of `image-set()` are ignored. | ||
They can be configured to emit a warning with `warn` or throw an exception with `throw`. | ||
```js | ||
postcssImageSetFunction({ oninvalid: 'warning' }) // warn on invalid usages | ||
postcssImageSetFunction({ onInvalid: 'warn' }) // warn on invalid usages | ||
``` | ||
```js | ||
postcssImageSetFunction({ oninvalid: 'throw' }) // throw on invalid usages | ||
postcssImageSetFunction({ onInvalid: 'throw' }) // throw on invalid usages | ||
``` | ||
@@ -133,0 +133,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23390
61