Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Process CSS synchronously? Plus add example to DOC. #236

Open
nolimitdev opened this issue Feb 18, 2021 · 0 comments
Open

Process CSS synchronously? Plus add example to DOC. #236

nolimitdev opened this issue Feb 18, 2021 · 0 comments

Comments

@nolimitdev
Copy link

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);
    });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant