Skip to content

Commit 4043e5e

Browse files
fix(all): Fix gruntfile for browserify
1 parent 3fccc47 commit 4043e5e

6 files changed

+21
-34
lines changed

Diff for: Gruntfile.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@ module.exports = function(grunt) {
44
pkg: grunt.file.readJSON('package.json'),
55

66
browserify: {
7-
'public/app.js': ['public/bundle']
7+
options: {
8+
debug: true
9+
},
10+
dev: {
11+
src: ['public/app.js'],
12+
dest: 'public/browserify-bundle.js'
13+
},
14+
production: {
15+
options: {
16+
debug: false
17+
},
18+
src: '<%= browserify.dev.src %>',
19+
dest: 'public/browserify-bundle.js'
20+
}
821
},
922

1023
mochaTest: {
@@ -49,7 +62,7 @@ module.exports = function(grunt) {
4962
separator: ';'
5063
},
5164
js: {
52-
src: ['public/js/**/*.js','public/app.js'],
65+
src: ['public/js/**/*.js'],
5366
dest: 'public/dist/<%= pkg.name %>.js'
5467
}
5568
},
@@ -89,11 +102,11 @@ module.exports = function(grunt) {
89102
});
90103

91104

105+
grunt.loadNpmTasks('grunt-browserify');
92106
grunt.loadNpmTasks('grunt-contrib-concat');
93107
grunt.loadNpmTasks('grunt-contrib-uglify');
94108
grunt.loadNpmTasks('grunt-contrib-clean');
95109
grunt.loadNpmTasks('grunt-contrib-jshint');
96-
grunt.loadNpmTasks('grunt-browserify');
97110
// grunt.loadNpmTasks('grunt-blanket');
98111
grunt.loadNpmTasks('grunt-mocha-test');
99112
grunt.loadNpmTasks('grunt-contrib-watch');
@@ -128,7 +141,7 @@ module.exports = function(grunt) {
128141
grunt.registerTask('local', ['jshint', 'test', 'nodemon']);
129142

130143

131-
grunt.registerTask('default', ['concat', 'uglify', 'cssmin']);
144+
grunt.registerTask('default', ['browserify', 'concat', 'uglify', 'cssmin']);
132145

133146

134147
// grunt.registerTask('upload', function(n) {

Diff for: public/app.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ app.navbarView = new NavbarView({ model: app.user });
1414
$('.navbar').append(app.navbarView.$el);
1515

1616
app.rulesView = new RulesView({ model: app.game });
17-
$('#rules').append(app.rulesView.$el);
18-
19-
20-
17+
$('#rules').append(app.rulesView.$el);

Diff for: public/bundle renamed to public/browserify-bundle.js

-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ $('.navbar').append(app.navbarView.$el);
1616

1717
app.rulesView = new RulesView({ model: app.game });
1818
$('#rules').append(app.rulesView.$el);
19-
20-
21-
22-
2319
},{"./game_classes/Game.js":4,"./helpers.js":9}],2:[function(require,module,exports){
2420
var Unoccupied = require('./Unoccupied.js');
2521

Diff for: public/dist/javascript-battle-website.js

+1-20
Original file line numberDiff line numberDiff line change
@@ -730,23 +730,4 @@ $('.navbar-collapse ul li a').click(function() {
730730
this.$el.append(heroView.$el);
731731
}.bind(this));
732732
}
733-
});;var app = {};
734-
735-
app.game = new Game();
736-
737-
var initialGame = require('./game_classes/Game.js');
738-
app.game.clientSideGame[0] = new initialGame(12);
739-
740-
app.game.helpers = require('./helpers.js');
741-
742-
app.gameView = new GameView({ model: app.game });
743-
$('.gamegrid-content').append(app.gameView.$el);
744-
745-
app.navbarView = new NavbarView({ model: app.user });
746-
$('.navbar').append(app.navbarView.$el);
747-
748-
app.rulesView = new RulesView({ model: app.game });
749-
$('#rules').append(app.rulesView.$el);
750-
751-
752-
733+
});

Diff for: public/dist/javascript-battle-website.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ <h2 class="winner-msg">Simulated Game</h2>
108108
<script src="./js/game/GameView.js"></script>
109109
<script src="./js/rules/RulesView.js"></script>
110110
<!-- // <script src="./app.js"></script> -->
111-
<script src="./bundle"></script>
111+
<script src="./browserify-bundle.js"></script>
112112
<!-- // <script src="./dist/javascript-battle-website.min.js"></script> -->
113113

114114
</body>

0 commit comments

Comments
 (0)