Yeoman/Grunt clean:dist任务属性未定义



我是grunt的新手,在grunt contrib clean的clean:dist任务中遇到了麻烦。这是我的任务代码。

clean: {
    dist: {
        files: [{
            dot: true,
            src: [
                '.tmp',
                '<%= yeoman.dist %>/*',
                '!<%= yeoman.dist %>/.git*',
                '!<%= yeoman.dist %>/Procfile',
                '!<%= yeoman.dist %>/package.json',
                '!<%= yeoman.dist %>/web.js',
                '!<%= yeoman.dist %>/node_modules'
           ]
        }]
    },
    server: '.tmp'
},

当我运行grunt build时,我收到以下警告:"处理模板时出错(无法读取未定义的属性dist)。请使用--force继续。"我认为这一定是语法错误或插件有问题,但我知道的还不够,无法继续解决。

由于某些原因,从<%=yeoman.list%>到<%=config.dist%>解决了我的问题。不确定什么时候使用yeoman.list语法合适,但无论如何我解决了自己的问题。所以解决方案是…

clean: {
  dist: {
    files: [{
      dot: true,
      src: [
        '.tmp',
        '<%= config.dist %>/*',
        '!<%= config.dist %>/.git*',
        '!<%= config.dist %>/Procfile',
        '!<%= config.dist %>/package.json',
        '!<%= config.dist %>/web.js',
        '!<%= config.dist %>/node_modules'
      ]
    }]
  },
  server: '.tmp'
},

最新更新