2016-09-02 1 views
0

grandfile.jsを設定しようとしましたが、それはhttp://gruntjs.com/configuring-taskshttps://24ways.org/2013/grunt-is-not-weird-and-hard/の下でした。だから私はそこに書いた:公式サイトのグランツの簡単なサンプルファイルで何が問題になっていますか?

module.exports = function(grunt) { 

    // 1. All configuration goes here 
    grunt.initConfig({ 
     pkg: grunt.file.readJSON('package.json'), 

     concat: { 
      // 2. Configuration for concatinating files goes here. 
    dist: { 
     src: [ 
      'css/bootstrap.css', // Bootstrap css in the libs folder 
     'css/normalize.css', // Normaliza.css in the libs folder 
      'css/style.css' // This specific file 
     ], 
     dest: 'css/build/production.css', 
     } 

    }); 

    // 3. Where we tell Grunt we plan to use this plug-in. 
    grunt.loadNpmTasks('grunt-contrib-concat'); 

    // 4. Where we tell Grunt what to do when we type "grunt" into the terminal. 
    grunt.registerTask('concat'); 
}; 

をその後、私はTEMINALを開けてgruntを書きました。 私が得たここで何を:

Loading "Gruntfile.js" tasks...ERROR 
>> SyntaxError: Unexpected token) 
Warning: Task "default" not found. Use --force to continue. 

Aborted due to warnings. 

I)は余分な)どちらも私が悪い作成 "デフォルト" のタスク(デフォルト=連結を見つけていませんでした。

ここで何が間違っていますか?おかげさまで

答えて

1

Gruntはデフォルトタスク(grunt.registerTask('default', [<task list here>])を登録することを期待していますが、にはがありません。登録したくない場合は、--forceオプションに合格するだけで、それでもあなたの仕事が実行されます。

+0

これは動作しません。私はこれをした後、私のproduction.cssファイルはまだ空です。ターミナルは次に言う:「Gruntfile.js」タスクをロード中...エラー >> SyntaxError:予期しないトークン) 警告:タスク「デフォルト」が見つかりません。 --forceを使用して、続行します。 完了しましたが、警告が表示されます。 –

関連する問題