2016-04-23 91 views
0

我在为EaselJS中的项目配置游戏开发时遇到了一些问题。您可以在下面看到我的Grunt.js文件。grunt命令在配置EaselJS项目时不运行服务器

module.exports = function(grunt) { 

// Project configuration. 
grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'), 
    browserify: { 
     build: { 
      files: { 
       'build/scripts/app.bundle.js': ['app/lib/main.js'] 
      } 
     } 
    }, 
    copy: { 
     scripts: { 
      src: [ 
       'bower_components/easeljs/lib/easeljs-0.8.0.combined.js', 
      ], 
      dest: 'build/scripts/', 
      expand: true, 
      flatten: true 
     }, 
     html: { 
      src: [ 
       'app/index.html', 
      ], 
      dest: 'build/', 
      expand: true, 
      flatten: true 
     } 
    }, 
    connect: { 
     server: { 
      options: { 
       port: 9001, 
       base: 'build' 
      } 
     } 
    }, 
    watch: { 
     options: { 
      livereload: true 
     }, 
     scripts: { 
      files: ['app/lib/**/*.js', 'app/*.html'], 
      tasks: ['build'] 
     } 
    } 
}); 

// Load the plugin that provides the "uglify" task. 
grunt.loadNpmTasks('grunt-contrib-copy'); 
grunt.loadNpmTasks('grunt-contrib-watch'); 
grunt.loadNpmTasks('grunt-contrib-connect'); 
grunt.loadNpmTasks('grunt-browserify'); 

// Default task(s). 
grunt.registerTask('build', ['browserify', 'copy']); 
grunt.registerTask('default', ['build', 'connect', 'watch']);}; 

每当我在命令行上运行grunt命令时,Windows会询问'如何打开此文件?'。当我选择我的浏览器时,它会打开并显示Grunt.js文件。

如果你能帮我解决这个问题,我会非常感激。谢谢

回答

1

好吧我想通了。我已经命名我的文件Grunt.js而不是Gruntfile.js。 我将它更改为Gruntfile.js,运行grunt命令,它按预期工作。

相关问题