2017-07-21 14 views
1
を言及するにもかかわらず、見つからない

質問をする前に尋ねるが、私は、私はタスクのデフォルトは、デフォルトタスク

SyntaxError: Invalid or unexpected token Warning: Task "default" not found. Use --force to continue.

を次のようにコンソールを読み込み、コードを実行grunt.Wheneverに新たなんだと、私はそれらのうちの多くの得ることができませんでしたがあります

私のコードは次のとおりです。

'use strict'; 
 

 
module.exports = function (grunt) { 
 
\t // Time how long tasks take. Can help when optimizing build times 
 
\t \t require('time-grunt')(grunt); 
 

 
\t // Automatically load required Grunt tasks 
 
\t \t require('jit-grunt')(grunt, { 
 
    useminPrepare: 'grunt-usemin' 
 
}); 
 
\t 
 
    // Define the configuration for all the tasks 
 
    
 
    
 
    grunt.initConfig({ 
 
\t 
 
\t pkg: grunt.file.readJSON('package.json'), 
 

 
    // Make sure code styles are up to par and there are no obvious mistakes 
 
    jshint: { 
 
    options: { 
 
     jshintrc: '.jshintrc', 
 
     reporter: require('jshint-stylish') 
 
    }, 
 
    
 
    all: { 
 
     src: [ 
 
     'Gruntfile.js', 
 
     'app/scripts/{,*/}*.js' 
 
     ] 
 
    } 
 
    }, 
 

 
    useminPrepare: { 
 
\t html: 'app/menu.htm 
 
\t }, 
 

 
useminPrepare: { 
 
    html: 'app/menu.html', 
 
    options: { 
 
    dest: 'dist' 
 
    } 
 
}, 
 

 
// Concat 
 
concat: { 
 
    options: { 
 
    separator: ';' 
 
    }, 
 
    
 
    // dist configuration is provided by useminPrepare 
 
    dist: {} 
 
}, 
 

 
// Uglify 
 
uglify: { 
 
    // dist configuration is provided by useminPrepare 
 
    dist: {} 
 
}, 
 

 
cssmin: { 
 
    dist: {} 
 
}, 
 

 
// Filerev 
 
filerev: { 
 
    options: { 
 
    encoding: 'utf8', 
 
    algorithm: 'md5', 
 
    length: 20 
 
    }, 
 
    
 
    release: { 
 
    // filerev:release hashes(md5) all assets (images, js and css) 
 
    // in dist directory 
 
    files: [{ 
 
     src: [ 
 
     'dist/scripts/*.js', 
 
     'dist/styles/*.css', 
 
     ] 
 
    }] 
 
    } 
 
}, 
 
    
 
// Usemin 
 
// Replaces all assets with their revved version in html and css files. 
 
// options.assetDirs contains the directories for finding the assets 
 
// according to their relative paths 
 
usemin: { 
 
    html: ['dist/*.html'], 
 
    css: ['dist/styles/*.css'], 
 
    options: { 
 
    assetsDirs: ['dist', 'dist/styles'] 
 
    } 
 
}, 
 
copy: { 
 
    dist: { 
 
    cwd: 'app', 
 
    src: [ '**','!styles/**/*.css','!scripts/**/*.js' ], 
 
    dest: 'dist', 
 
    expand: true 
 
    }, 
 
    
 
    fonts: { 
 
    files: [ 
 
     { 
 
     //for bootstrap fonts 
 
     expand: true, 
 
     dot: true, 
 
     cwd: 'bower_components/bootstrap/dist', 
 
     src: ['fonts/*.*'], 
 
     dest: 'dist' 
 
     }, { 
 
     //for font-awesome 
 
     expand: true, 
 
     dot: true, 
 
     cwd: 'bower_components/font-awesome', 
 
     src: ['fonts/*.*'], 
 
     dest: 'dist' 
 
     } 
 
    ] 
 
    } 
 
}, 
 

 
clean: { 
 
    build: { 
 
    src: [ 'dist/'] 
 
    } 
 
    } 
 
    }); 
 
\t 
 
\t \t grunt.registerTask('build', [ 
 
    'clean', 
 
    'jshint', 
 
    'useminPrepare', 
 
    'concat', 
 
    'cssmin', 
 
    'uglify', 
 
    'copy', 
 
    'filerev', 
 
    'usemin' 
 
]); 
 

 
\t \t grunt.registerTask('default' , ['build']); 
 
};

+0

grunfileと同じディレクトリからgruntを呼び出していますか?また引数を指定しますか? – user1859022

+0

はい、私は同じディレクトリからgruntを呼び出しています –

答えて

0

あなたのイサキコールの完全な出力があなたのgruntfile.jsがsytaxのERROを持っていることを示していますR:

Loading "gruntfile.js" tasks...ERROR
>> SyntaxError: Invalid or unexpected token Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

そして実際にあなたのファイルは、行には閉じる引用符を持っていない:

useminPrepare: { 
    html: 'app/menu.htm <-----!!!!!!!! 
}, 

useminPrepare: { 
    html: 'app/menu.html', 
    options: { 
    dest: 'dist' 
    } 
}, 

おそらくコピーペーストエラーをあなたは二度(strictモードでは違法であるuseminPrepareを持っているので、 btw ...)

関連する問題