配置 EaselJS 项目时,g运行t 命令不会 运行 服务器
grunt command does not run server while configuring EaselJS project
我在为 EaselJS 中的游戏开发配置项目时遇到了一些问题。下面你可以看到我的 Grunt.js
文件。
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']);};
每当我在命令行上 运行 g运行t 命令时,Windows 会询问 'How to open this file?'。当我选择浏览器时,它会打开并显示 Grunt.js 文件。
如果您能帮我解决这个问题,我将不胜感激。谢谢
好的,我明白了。我将我的文件命名为 Grunt.js
而不是 Gruntfile.js
。
我将其更改为 Gruntfile.js
、运行 grunt 命令,它按预期工作。
我在为 EaselJS 中的游戏开发配置项目时遇到了一些问题。下面你可以看到我的 Grunt.js
文件。
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']);};
每当我在命令行上 运行 g运行t 命令时,Windows 会询问 'How to open this file?'。当我选择浏览器时,它会打开并显示 Grunt.js 文件。
如果您能帮我解决这个问题,我将不胜感激。谢谢
好的,我明白了。我将我的文件命名为 Grunt.js
而不是 Gruntfile.js
。
我将其更改为 Gruntfile.js
、运行 grunt 命令,它按预期工作。