yeoman角-grunt构建不会制作dist文件夹

时间:2019-05-07 16:15:30

标签: angularjs angular-upgrade

enter image description here 我正在尝试使用Yeoman构建角度应用程序

但是当我运行GRUNT BUILD时,它没有创建任何DIST文件夹

我是Grunt的新手,我已经安装了“ grunt-contrib-concat”,我们正在尝试使用grunt构建AngularJs-V1.7.7(基于组件的体系结构)应用程序,该应用程序包含这两者(控制器体系结构) &(基于组件的体系结构)。

如何在一个缩小文件中同时连接控制器和组件。

遇到类似这样的错误:

任务“ concat”失败。使用--force继续

var appConfig = {     应用:require('./ bower.json')。appPath || 'app',     dist:“ dist”   };

grunt.initConfig({     yeoman:appConfig,     观看:{       凉亭:{         文件:['bower.json'],         任务:['wiredep']       },       js:{         文件:['<%= yeoman.app%> / scripts / {, /} .js','<%= yeoman.app%> / components / {, /} < /em>.js'],         任务:['newer:jshint:all'],         选项:{           livereload:“ <%= connect.options.livereload%>”         }       },       jsTest:{         文件:['test / spec / {, /} .js'],         任务:['newer:jshint:test','karma']       },       样式:{         文件:['<%= yeoman.app%> / styles / {, /} .css'],         任务:['newer:copy:styles','autoprefixer']       },       gruntfile:{         档案:['Gruntfile.js']       },       livereload:{         选项:{           livereload:“ <%= connect.options.livereload%>”         },         文件:[           '<%= yeoman.app%> / {, /} .html',           '.tmp / styles / {, /} .css',           '<%= yeoman.app%> / images / {, /} 。{png,jpg,jpeg,gif,webp,svg}'         ]       }     }

connect: {
  dist: {
    options: {
      open: true,
      base: '<%= yeoman.dist %>'
    }
  }
},
jshint: {
  options: {
    jshintrc: '.jshintrc',
    reporter: require('jshint-stylish')
  },
  all: {
    src: [
      'Gruntfile.js',
      '<%= yeoman.app %>/scripts/{,*/}*.js',
      '<%= yeoman.app %>/components/{,*/}*.js'
    ]
  },
  test: {
    options: {
      jshintrc: 'test/.jshintrc'
    },
    src: ['test/spec/{,*/}*.js']
  }
},
clean: {
  dist: {
    files: [{
      dot: true,
      src: [
        '.tmp',
        '<%= yeoman.dist %>/{,*/}*',
        '!<%= yeoman.dist %>/.git{,*/}*'
      ]
    }]
  },
  server: '.tmp'
},

wiredep: {
  app: {
    src: ['<%= yeoman.app %>/index.html'],
    ignorePath: /\.\.\//
  },
  test: {
    devDependencies: true,
    src: '<%= karma.unit.configFile %>',
    ignorePath: /\.\.\//,
    fileTypes: {
      js: {
        block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
        detect: {
          js: /'(.*\.js)'/gi
        },
        replace: {
          js: '\'{{filePath}}\','
        }
      }
    }
  }
},
filerev: {
  dist: {
    src: [
      '<%= yeoman.dist %>/scripts/{,*/}*.js',
      '<%= yeoman.dist %>/components/{,*/}*.js',
      '<%= yeoman.dist %>/styles/{,*/}*.css',
      '<%= yeoman.dist %>/css/{,*/}*.css',
      '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
      '<%= yeoman.dist %>/styles/fonts/*'
    ]
  }
},
useminPrepare: {
  html: '<%= yeoman.app %>/index.html',
  options: {
    dest: '<%= yeoman.dist %>',
    flow: {
      html: {
        steps: {
          js: ['concat', 'uglifyjs'],
          css: ['cssmin']
        },
        post: {}
      }
    }
  }
},
usemin: {
  html: ['<%= yeoman.dist %>/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
  options: {
    assetsDirs: [
      '<%= yeoman.dist %>',
      '<%= yeoman.dist %>/images',
      '<%= yeoman.dist %>/styles',
      '<%= yeoman.dist %>/css'
    ]
  }
},
svgmin: {
  dist: {
    files: [{
      expand: true,
      cwd: '<%= yeoman.app %>/images',
      src: '{,*/}*.svg',
      dest: '<%= yeoman.dist %>/images'
    }]
  }
},

htmlmin: {
  dist: {
    options: {
      collapseWhitespace: true,
      conservativeCollapse: true,
      collapseBooleanAttributes: false,
      removeCommentsFromCDATA: true,
      removeOptionalTags: true
    },
    files: [{
      expand: true,
      cwd: '<%= yeoman.dist %>',
      src: ['*.html', 'views/{,*/}*.html'],
      dest: '<%= yeoman.dist %>'
    }]
  }
},
ngAnnotate: {
  dist: {
    files: [{
      expand: true,
      cwd: '.tmp/concat/scripts',
      src: '*.js',
      dest: '.tmp/concat/scripts'
    }]
  }
},
copy: {
  dist: {
    files: [{
      expand: true,
      dot: true,
      cwd: '<%= yeoman.app %>',
      dest: '<%= yeoman.dist %>',
      src: [
        '*.{ico,png,txt}',
        '.htaccess',
        '*.html',
        'views/{,*/}*.html',
        'components/{,*/}*.html',
        'images/{,*/}*.{webp}',
        'styles/fonts/{,*/}*.*'
      ]
    }, {
      expand: true,
      cwd: '.tmp/images',
      dest: '<%= yeoman.dist %>/images',
      src: ['generated/*']
    }, {
      expand: true,
      cwd: 'bower_components/bootstrap/dist',
      src: 'fonts/*',
      dest: '<%= yeoman.dist %>'
    }]
  },
  styles: {
    expand: true,
    cwd: '<%= yeoman.app %>/styles',
    dest: '.tmp/styles/',
    src: '{,*/}*.css'
  }
},
concurrent: {
  server: [
    'copy:styles'
  ],
  test: [
    'copy:styles'
  ],
  dist: [
    'copy:styles',
    //'imagemin',
    'svgmin'
  ]
},

// Test settings
karma: {
  unit: {
    configFile: 'test/karma.conf.js',
    singleRun: true
  }
}

});

0 个答案:

没有答案