lahmatiy / postcss-csso

PostCSS plugin to minify CSS using CSSO
MIT License
119 stars 6 forks source link

Better way to replace Root #1

Closed ai closed 8 years ago

ai commented 8 years ago
    return function (root, result) {
        var minified = csso.minify(root.toString(), options);
        result.root = postcss.parse(minified, result.opts);
    }

It is cleaner and also saves file name

lahmatiy commented 8 years ago

@ai Yep, I discovered this solution, but w/o options for parse. But I stuck with source map for now. I need to pass result source map to csso, but I have no access to postcss map-generator and don't know another way to get source map.

lahmatiy commented 8 years ago

Now it's using AST converting (postcss->csso->postcss) with no re-parsing. So problem with source maps is solved.

ai commented 8 years ago

Nice, AST converter is useful thing.