Grunt PostCSS 编译非常慢

Grunt PostCSS compilation very slow

我纯粹出于好奇尝试了 postCSS,但我的编译时间已经大约 2 秒了。

我只使用了 3 个插件:autoprefixerpostcss-importpostcss-nested

我有 app.css 导入 2 个文件:

@import "_base/_base.css";

@import "_common/_common.css";

然后我有 _base.css :

.title {
    display: flex;
    color: white;
}

_common.css

header {
    background: red;

    h1 {
        background: black;
    }
}

我的观察者只在观察/postCSS :

    ...
    watch: {
        postcss: {
            files: grunt.settings.devDir + 'postCSS/{,**/}*.css',
            tasks: ['postcss:dev']
        }
    },
    ...

postcss:开发任务:

        dev: {
            options: {
                map: false,
                processors: [
                    require('autoprefixer')({browsers: 'last 1 versions'}),
                    require('postcss-import')(),
                    require('postcss-nested')()
                ]
            },
            files: [{
                expand: true,
                cwd: grunt.settings.devDir + 'postCSS/',
                src: ['app.css'],
                dest: grunt.settings.devDir + 'css/'
            }]
        },

所以我的问题是,我怎样才能得到 2 秒的时间来编译 3 个 css 小文件?我错过了什么吗?

谢谢!

现在,PostCSS 有这个问题,太慢了。

this 文章中,作者复制了使用 PostCSS 和不使用 PostCSS 的工作流程。最终结果让你觉得 PostCSS 有很大的潜力,但你应该用 CSSNext 版本改变你的工作任务。