The Word node inherits directly from Node in PostCSS. This node is a catch-all for values which start with word-characters, or for certain types of words with special decorations, such as variables and colors.
Type: Boolean
If true, denotes that the word represents a color.
Type: Boolean
If true, denotes that the word represents a hexadecimal value.
Type: Boolean
If true, denotes that the word represents a URL value. This includes URL values that originate from url(...).
Type: Boolean
If true, denotes that the word's value is recognized as a parseable URL by is-url-superb.
Type: Boolean
If true, denotes that the word represents a CSS variable.
Type: String
Value: 'word'
Type: String
The value of the word.
bold
min-width
--color
-webkit-transition
#fff
https://example.comURL values are represented as Word nodes. Use isUrl to determine whether a Word is a URL value, and use isParseableUrl to determine whether the URL string itself is parseable.
For url(...), quoted and unquoted absolute URLs normalize to the same value.
import { parse } from 'postcss-values-parser';
const unquotedAbsolute = parse('url(https://example.com/image.png)').nodes[0];
const quotedAbsolute = parse("url('https://example.com/image.png')").nodes[0];
const relative = parse('url(/images/image.png)').nodes[0];
console.log(unquotedAbsolute.value === quotedAbsolute.value); // true
console.log(unquotedAbsolute.isUrl); // true
console.log(unquotedAbsolute.isParseableUrl); // true
console.log(quotedAbsolute.isUrl); // true
console.log(quotedAbsolute.isParseableUrl); // true
console.log(relative.isUrl); // true
console.log(relative.isParseableUrl); // false