postcss-js icon indicating copy to clipboard operation
postcss-js copied to clipboard

.sync API

Open gkatsanos opened this issue 1 year ago • 1 comments

Just had a nasty issue that took .. a few hours of my life .. using .sync without anything passed, didn't realize an empty array was at least expected.

const plugin = require("tailwindcss/plugin");
const postcssJs = require("postcss-js");
const styles = require("../dist/styles");

module.exports = plugin(function ({ addComponents }) {
  let postcssJsProcess;
  postcssJsProcess = postcssJs.sync(); // ... []
  result = postcssJsProcess(styles);
  addComponents(result);
});

Any way to clarify the Readme a bit to add an example or two for .sync?

gkatsanos avatar Mar 20 '23 11:03 gkatsanos

What problem do you have of passing undefined to postcssJs.sync()?

We can throw an error on missed argument.

ai avatar Mar 20 '23 13:03 ai