Skip to content
This repository was archived by the owner on Feb 3, 2020. It is now read-only.

Asynchronously set options #56

@garygreen

Description

@garygreen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions