Process CSS synchronously? Plus add example to DOC.
nolimitdev opened this issue · 0 comments
nolimitdev commented
1.) Is sync way available? I see in source code in index.cjs.js that it should return sync function when there is no import and export in options const canReturnSyncFunction = importFrom.length === 0 && exportTo.length === 0;
but it seem to do nothing, always Promise/LazyResult is returned.
2.) Also it would be nice to add example here https://github.com/postcss/postcss-custom-properties/blob/master/INSTALL.md#node how to process CSS text and get it returned (not exported to file) because it took some time for me to understand how it works. There should be example(s):
var result = await PostcssCustomProperties.process('...YOUR_CSS_TO_PROCESS...', /* processOptions: */ { from: undefined }, /* pluginOptions: */ { preserve : false });
console.log(result.css);
PostcssCustomProperties.process('...YOUR_CSS_TO_PROCESS...', /* processOptions: */ { from: undefined }, /* pluginOptions: */ { preserve : false })
.then((result) => {
console.log(result.css);
});