borodean / postcss-assets

An asset manager for PostCSS
MIT License
537 stars 32 forks source link

Common PostCSS API #6

Closed ai closed 9 years ago

ai commented 9 years ago

Most of PostCSS plugins works as plugin instead of plugin() if there is no options.

postcss([
    require('autoprefixer-core'),
    require('postcss-nested'),
    require('postcss-mixins'),
    require('postcss-assets')() // ugly
])

I make this behavior by:

module.exports = function (opts) {
    //  work with options
    return function (css) {
        // work with AST
    };
};

module.exports.postcss = function (css) {
    module.exports()(css);
};
ai commented 9 years ago

/cc @borodean

borodean commented 9 years ago

@ai if this would be implemented, and since it changes the API, how semver says the version should be updated?

ai commented 9 years ago

I think here is x.x.X release, because it is expected behaviour and we fix it.

But also we you change x.X.x, because we add new API (but didn’t broke old APIs).