Gruntjs gruntfile中的postsss配置问题

Gruntjs gruntfile中的postsss配置问题,gruntjs,Gruntjs,快速提问,试着让PostSS工作并继续 "SyntaxError: /Users/todd.kidder/Documents/sitecore-site/Gruntfile.js:40 >> });" 运行默认任务时出错 我确信这个错误是显而易见的,但在这一点上是全新的,我是一个css爱好者 谢谢你对我的帮助 module.exports = function(grunt) { // 1. All configuration goes here

快速提问,试着让PostSS工作并继续

"SyntaxError: /Users/todd.kidder/Documents/sitecore-site/Gruntfile.js:40
>>         });" 
运行默认任务时出错

我确信这个错误是显而易见的,但在这一点上是全新的,我是一个css爱好者

谢谢你对我的帮助

module.exports = function(grunt) {

    // 1. All configuration goes here 
    grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
            uncss: {
                dist: {
                    files: {
                        'cleaned-css/tidy.css': ['index.html']
                    }
                }
            },
            cssnano: {
                options: {
                    sourcemap: true
                },
                dist: {
                    files: {
                        'cleaned-css/tidy.css': 'cleaned-css/tidy.css'
                    }
                }
            },
            postcss: {
                options: {
                    map: true,
                    processors: [
                        require('autoprefixer-core')({
                            browsers: 'last 2 version'
                        }).postcss,
                    ]
                },
                dist: {
                    expand: true,
                    flatten: true,
                    src: 'cleaned-css/tidy.css'
                }
            }
        }

    });


// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-cssnano');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('autoprefixer');


// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['uncss', 'postcss']);
grunt.registerTask('build', ['uncss', 'postcss', 'cssnano']);

};

我认为这是一个简单的打字问题

请试试这个:


    module.exports = function(grunt) {

        // 1. All configuration goes here 
        grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
            uncss: {
                dist: {
                    files: {
                        'cleaned-css/tidy.css': ['index.html']
                    }
                }
            },
            cssnano: {
                options: {
                    sourcemap: true
                },
                dist: {
                    files: {
                        'cleaned-css/tidy.css': 'cleaned-css/tidy.css'
                    }
                }
            },
            postcss: {
                options: {
                    map: true,
                    processors: [
                        require('autoprefixer-core')({
                            browsers: 'last 2 version'
                        }).postcss,
                    ]
                },
                dist: {
                    expand: true,
                    flatten: true,
                    src: 'cleaned-css/tidy.css'
                }
            }
        })
    };


    // 3. Where we tell Grunt we plan to use this plug-in.
    grunt.loadNpmTasks('grunt-uncss');
    grunt.loadNpmTasks('grunt-cssnano');
    grunt.loadNpmTasks('grunt-postcss');
    grunt.loadNpmTasks('autoprefixer');


    // 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
    grunt.registerTask('default', ['uncss', 'postcss']);
    grunt.registerTask('build', ['uncss', 'postcss', 'cssnano']);
    
希望有帮助

向你问好,米莎