grunt compass 运行报错

CUqegp
  • 2
新手上路,请多包涵

这是我的配置gruntfiles文件

'use strict';
module.exports = function (grunt) {

    var makeGruntTask = require('./grunt/makeConfig');

    // var configMap = ['local', 'dev', 'uat', 'beta', 'production'];
    // make progress bar of time
    require('time-grunt')(grunt);
    // load all grunt tasks matching the ['grunt-*', '@*/grunt-*'] patterns
    require('load-grunt-tasks')(grunt, {
        pattern: ['grunt-*', '@*/grunt-*']
    });

    grunt.event.on('watch', function (action, filepath, target) {
        console.log(target + ': ' + filepath + ' has ' + action)
        // grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
    });

    makeGruntTask(grunt, {
        src: 'src',
        dist: 'dist',
        tmp: '.tmp'
    });

    grunt.registerTask('default', ['local']);

};

grunt config文件

'use strict';
module.exports = function (grunt, opts) {
    return {
        pkg: grunt.file.readJSON('package.json'),
        options: opts,
        connect: {
            //这里为插件子刷新方式
            options: {
                port: 9000,
                hostname: 'localhost', //默认就是这个值,可配置为本机某个 IP,localhost 或域名
                livereload: 35729 //声明给 watch 监听的端口
            },
            server: {
                options: {
                    open: true, //自动打开网页 http://
                    base: [
                        '.' //主目录
                    ]
                }
            }

        },
        watch: {
            includereplace: {
                files: ['<%= options.src %>/html/**/*.html'],
                tasks: ['includereplace']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            styles: {
                files: ['<%= options.src %>/sass/{*/,**/}*.{scss,sass}'],
                tasks: ['compass']
            }
        },

        browserSync: {
            options: {
                notify: false,
                // run registerMultiTask()
                background: true,
                watchOptions: {
                    ignored: ''
                }
            },
            livereload: {
                options: {
                    files: [
                        '<%= options.src %>/js/{,**/}*.js',
                        '<%= options.src %>/images/{,**/}*.*',
                        '<%= options.tmp %>/{,**/}*.html',
                        '<%= options.tmp %>/css/{,**/}*.css',
                    ],
                    port: 9000,
                    server: {
                        baseDir: ['<%= options.tmp %>', '<%= options.src %>'],
                        routes: {
                            '/bower_components': './bower_components'
                        }
                    }
                }
            }
        },

        includereplace: {
            build: {
                expand: true,
                cwd: '<%= options.src %>/html/module',
                src: '{*/,**/}*.html',
                dest: '<%= options.tmp %>'
            }
        },

        compass: {
            dist: {
                options: {
                    config: 'compass/config.rb'
                }
            }
        },

        requirejs: require('../require/config'),

        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= options.src %>/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: '<%= options.tmp %>/images'
                }]
            }
        },

        filerev: {
            dist: {
                options: {
                    algorithm: 'md5',
                    length: 16,
                    process: function (basename, name, extension) {
                        return basename + '.' + 'v' + name + '.' + extension;
                    }
                },
                src: ['<%= options.tmp %>/css/{*/,**/}/*.css']
            }
        },

        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: ['<%= options.dist %>{,**/}']
                }]
            },
            server: '.tmp',
            require: '.js'
        },

        copy: {
            dist: {
                files: [{
                        expand: true,
                        dot: true,
                        cwd: '<%= options.src %>',
                        dest: '<%= options.dist %>',
                        src: ['fonts/{, **/}*', '*.xml', '*.ico']
                    },
                    {
                        expand: true,
                        dot: true,
                        cwd: '.js',
                        // 展平
                        // flatten: true,
                        src: ['conf/**/*.js', 'lib/require/require.js', '*.js', 'lib/oniui/{,**/}**', 'lib/{,**/,}uploadify.swf'],
                        dest: '<%= options.dist %>/js'
                    },
                    {
                        expand: true,
                        dot: true,
                        cwd: '<%= options.tmp %>',
                        src: ['**/*.html', 'images/**/*.*', 'css/**/*.css', '!css/**/*.css.map'],
                        dest: '<%= options.dist %>'
                    }
                ]
            }
        }

    };

};

运行就会报错
image.png

回复
阅读 187
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏