Currently you can only supply options to the plugin with an object. It would be useful if you could also pass a function and call the given setPurgeCssOptions callback to set the options.
require('@fullhuman/postcss-purgecss')(function(setPurgeCssOptions) {
exec_command('git ls-files js/*.js', function(gitFiles) {
setPurgeCssOptions({
content: toArray(gitFiles),
});
});
});
Use case
Our particular use case is we want to build up a list of content files for PurgeCSS to consider but only if it's part of git/version control - as we are calling an async process we need to build the options up asynchronously. It's possible we could do this by creating our own plugin and then hooking into that, but I just thought I'd make this suggestion as it would provide an easier API.