Skip to content

Commit ac6a459

Browse files
committed
resolve: docs rebase conflicts; keep dynamic-import CJS guidance and parser header wording
1 parent 887f581 commit ac6a459

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ npm install postcss-values-parser --save-dev
2727
- Node.js >= 20.19.0
2828
- PostCSS >= 8.4.14 (peer dependency)
2929

30-
Note: This package is ESM‑only. Use `import` in Node.js. In CommonJS on Node.js 20.19.0+ you can `require()` it:
30+
Note: This package is ESM‑only. Use `import` in Node.js. In CommonJS, load it via dynamic import:
3131

3232
```js
33-
// CommonJS (Node >= 20.19.0)
34-
const { parse } = require('postcss-values-parser');
35-
```
33+
// CommonJS
34+
import('postcss-values-parser').then(({ parse }) => {
35+
// use parse(...)
36+
});
3637
```
3738

3839
## Benefits

docs/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,17 @@ Please see the [Exports](./Exports.md) documentation for further information.
1616

1717
Parsing is powered by [css-tree](https://github.com/csstree/csstree). Nodes in this package extend PostCSS `Node`/`Container`/`Root` so the API feels familiar, but there is no PostCSS parser involved.
1818

19-
> Note: This package is ESM‑only. Prefer `import` in Node.js. For CommonJS on Node >= 20.19.0 you can use:
19+
> Note: This package is ESM‑only. Use `import` syntax in Node.js. If you must use CommonJS, load it via dynamic import:
2020
>
2121
> ```js
22-
> // CommonJS (Node >= 20.19.0)
23-
> const { parse } = require('postcss-values-parser');
24-
> ```
25-
>
26-
> On older Node versions, use dynamic import instead.
27-
>
28-
> ```js
29-
> // CommonJS (older Node)
22+
> // CommonJS
23+
> import('postcss-values-parser').then(({ parse }) => {
24+
> const root = parse('#fff');
25+
> });
26+
> // or
3027
> (async () => {
3128
> const { parse } = await import('postcss-values-parser');
29+
> const root = parse('#fff');
3230
> })();
3331
> ```
3432

docs/Stringify.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const root = parse('calc(100px + 20%)');
139139
console.log(root.toString()); // 'calc(100px + 20%)'
140140

141141
// Custom stringification
142-
console.log(root.toString(customStringifier));
142+
console.log(root.toString(upperCaseStringifier));
143143
```
144144

145145
## Advanced Usage

0 commit comments

Comments
 (0)