1
を言及するにもかかわらず、見つからない
質問をする前に尋ねるが、私は、私はタスクのデフォルトは、デフォルトタスク
を次のようにコンソールを読み込み、コードを実行grunt.Wheneverに新たなんだと、私はそれらのうちの多くの得ることができませんでしたがありますSyntaxError: Invalid or unexpected token Warning: Task "default" not found. Use --force to continue.
私のコードは次のとおりです。
'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']);
};
grunfileと同じディレクトリからgruntを呼び出していますか?また引数を指定しますか? – user1859022
はい、私は同じディレクトリからgruntを呼び出しています –