Skip to content

Commit

Permalink
chore: process-feat - doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
elycruz committed Aug 21, 2024
1 parent 91c0d4b commit 91a0457
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sass({
})
```

The `processor` also support object result. Reverse `css` filed for stylesheet, the rest properties can be customized.
The `processor` also support object result. Reverse `css` filLed for stylesheet, the rest of the properties can be customized.

```js
sass({
Expand All @@ -132,6 +132,36 @@ Otherwise, you could do:
import style, { foo, bar } from 'stylesheet';
```

#### Exporting sass variable to *.js

Example showing how to use [icss-utils](https://www.npmjs.com/package/icss-utils) to extract resulting sass vars
to your *.js bundle:

```js
const config = {
input: 'test/fixtures/processor-promise/with-icss-exports.js',
plugins: [
sass({
processor: (css) => new Promise((resolve, reject) => {
const pcssRootNodeRslt = postcss.parse(css),
extractedIcss = extractICSS(pcssRootNodeRslt, true),
cleanedCss = pcssRootNodeRslt.toString(),
out = Object.assign({}, extractedIcss.icssExports, {
css: cleanedCss,
});
// console.table(extractedIcss);
// console.log(out);
resolve(out);
}),
options: sassOptions,
}),
],
}
```

See the [Input file](test/fixtures/processor-promise/with-icss-exports.js) for example on how to access
the exported vars.

### `runtime`

+ Type: `Object` _(default: sass)_
Expand Down

0 comments on commit 91a0457

Please sign in to comment.