diff --git a/app/index.js b/app/index.js
index fd3122a..7c6a7a8 100644
--- a/app/index.js
+++ b/app/index.js
@@ -37,6 +37,9 @@ CraftyGenerator.prototype.app = function app() {
};
CraftyGenerator.prototype.projectfiles = function projectfiles() {
+ this.mkdir('app/web/css');
+ this.mkdir('app/web/images');
+
this.copy('_.editorconfig', '.editorconfig');
this.copy('_.jshintrc', '.jshintrc');
@@ -47,6 +50,9 @@ CraftyGenerator.prototype.projectfiles = function projectfiles() {
this.copy('src/entities/base/_BaseEntity.js', 'app/src/entities/base/BaseEntity.js');
this.copy('src/interfaces/_info.js', 'app/src/interfaces/info.js');
this.copy('src/scenes/_main.js', 'app/src/scenes/main.js');
+
+ this.copy('src/libs/crafty/_crafty.js', 'app/src/libs/crafty/crafty.js');
+ this.copy('src/libs/crafty/_crafty.min.js', 'app/src/libs/crafty/crafty.min.js');
};
CraftyGenerator.prototype.gruntfileJSON = function gruntfile() {
diff --git a/app/templates/_Gruntfile.js b/app/templates/_Gruntfile.js
index a1b1d38..05a90da 100644
--- a/app/templates/_Gruntfile.js
+++ b/app/templates/_Gruntfile.js
@@ -6,21 +6,38 @@ var mountFolder = function (connect, dir) {
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
- clean: ['build/'],
+ clean: ['dist'],
uglify: {
- options: {
- banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
- },
- build: {
- src: ['src/**/*.js', '!src/libs/**'],
- dest: 'build/src/<%= pkg.name %>.min.js'
- }
+ build: {
+ files: [{
+ expand: true,
+ cwd: 'app/src/',
+ src: ['**/*.js', '!libs/**/*'],
+ dest: 'dist/src/',
+ ext: 'a.js'
+ },
+ {
+ expand: true,
+ flatten: true,
+ cwd: 'app/src/libs/',
+ src: ['jquery/jquery.js', 'modernizr/modernizr.js'],
+ dest: 'dist/src/libs/',
+ ext: '.min.js'
+ },
+ {
+ 'dist/src/libs/requirejs-jquery.min.js': ['app/src/libs/requirejs-jquery/parts/require.js', 'app/src/libs/requirejs-jquery/parts/query.js']
+ }]
+ }
},
copy: {
- dev: {
+ dist: {
files: [{
- src: 'src/libs/*.js',
- dest: 'build/'
+ expand: true,
+ flatten: true,
+ cwd: 'app/src/libs/',
+ src: ['backbone/backbone-min.js', 'backbone/backbone-min.map', 'underscore/underscore-min.js', 'underscore/underscore-min.map', 'crafty/crafty.min.js'],
+ dest: 'dist/src/libs/',
+ filter: 'isFile'
}]
}
},
@@ -29,14 +46,13 @@ module.exports = function(grunt) {
options: {
port: 8888,
hostname: 'localhost',
- base: "app"
+ base: "app/"
}
},
livereload: {
options: {
middleware: function (connect) {
- return [
- require('connect-livereload')({port: LIVERELOAD_PORT}),
+ return [require('connect-livereload')({port: LIVERELOAD_PORT}),
mountFolder(connect, '.')
];
}
@@ -49,16 +65,14 @@ module.exports = function(grunt) {
}
},
watch: {
- options: {
- nospawn: true,
- livereload: LIVERELOAD_PORT
- },
- livereload: {
- files: [
- 'app/index.html'
- ],
- tasks: ['build']
- }
+ html: {
+ options: { livereload: true },
+ files: ['app/index.html'],
+ },
+ js: {
+ options: { livereload: true },
+ files: ['app/src/**/*.js']
+ }
}
});
@@ -67,9 +81,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-open');
grunt.registerTask('build', ['clean', 'uglify', 'copy']);
- grunt.registerTask('server', ['build', 'connect:server', 'open', 'watch']);
- grunt.registerTask('default', ['build', 'server']);
-}
\ No newline at end of file
+ grunt.registerTask('server', ['connect:server', 'open', 'watch']);
+ grunt.registerTask('default', ['server']);
+}
diff --git a/app/templates/_bower.json b/app/templates/_bower.json
index 2cf8f14..a85f924 100644
--- a/app/templates/_bower.json
+++ b/app/templates/_bower.json
@@ -8,7 +8,6 @@
"underscore": "~1.5.2",
"backbone": "~1.1.0",
"modernizr": "~2.6.2",
- "requirejs-jquery": "~0.25.0",
- "crafty": "~0.5.4"
+ "requirejs-jquery": "~0.25.0"
}
}
\ No newline at end of file
diff --git a/app/templates/_index.html b/app/templates/_index.html
index ad0ffd8..627d0f1 100755
--- a/app/templates/_index.html
+++ b/app/templates/_index.html
@@ -20,12 +20,11 @@
-
-
-
+
+
+
-
+