我怎么能在一个Javascript文件上运行grunt?

时间:2015-04-06 14:04:23

标签: javascript angularjs gruntjs yeoman karma-jasmine

我的项目中有很多javascript错误,当我在我的项目上运行grunt时,由于错误,它从未完成扫描停止在某个百分比,我如何只为一个文件设置grunt。任何帮助将不胜感激。

这是我项目的Gruntfile。

Gruntfile.js

module.exports = function(grunt) {
    require('load-grunt-tasks')(grunt);
    require('time-grunt')(grunt);

    grunt.initConfig({
        // Project settings
        yeoman: {
            app: 'src/main/webapp',
            dist: 'target/generated-source/yeoman'
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: ['.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.svn*', 'ngdoc/generated', 'target/ngdoc']
                }]
            }
        },
        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '**/*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },
        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: ['<%= yeoman.dist %>/scripts/**/*.js', '<%= yeoman.dist %>/styles/**/*.css', '<%= yeoman.dist %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}']
                }
            }
        },
        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            html: ['<%= yeoman.app %>/*.html', '<%= yeoman.app %>/views/**/*.html'],
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },
        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            html: ['<%= yeoman.dist %>/**/*.html'],
            css: ['<%= yeoman.dist %>/styles/**/*.css'],
            js: ['<%= yeoman.dist %>/scripts/**/*.js'],
            options: {
                assetsDirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/styles/**/*'],
                patterns: {
                    js: [[/css:"assets\/styles\/?[A-Za-z]*\/+([A-Za-z0-9]+\.css)"}/g, 'revved css resolves']]
                }
            }
        },
        // Allow the use of non-minsafe AngularJS files. Automatically makes it
        // minsafe compatible so Uglify does not destroy the ng references
       ngAnnotate: {
        dist: {
            files: [{
                expand: true,
                cwd: '.tmp/concat/scripts',
                src: '*.js',
                dest: '.tmp/concat/scripts',
                exclude: 'vendor.js'
            }]
        },
        dist1: {
          files: [{
              expand: true,
              cwd: '.tmp/concat/scripts',
              src: 'controller.js',
              dest: '.tmp/concat/scripts',
              exclude: '!vendor.js'
          }]
      }
    },

0 个答案:

没有答案