Used browserify for clientside js

This commit is contained in:
AlexKvazos
2015-04-28 02:57:59 -05:00
parent bf1699d01c
commit 397ae7d322
9 changed files with 43 additions and 14 deletions
+1
View File
@@ -1,2 +1,3 @@
node_modules/ node_modules/
public/js/
*.log *.log
+35
View File
@@ -0,0 +1,35 @@
module.exports = function(grunt) {
grunt.initConfig({
browserify: {
dev: {
files: {
'public/js/app.js': ['app/client/**/*.js'],
},
options: {
browserifyOptions: {
debug: true
}
}
},
pro: {
files: {
'public/js/app.js': ['app/client/**/*.js'],
},
options: {
browserifyOptions: {
debug: false
}
}
}
}
});
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('build', ['browserify:pro']);
grunt.registerTask('debug', ['browserify:dev']);
}
-6
View File
@@ -30,12 +30,6 @@ app.factory('buffer', function() {
/** /**
* CONTROLLERS * CONTROLLERS
*/ */
View File
+4 -7
View File
@@ -19,18 +19,15 @@ var io = require('socket.io')(server);
require('./sockets')(io); require('./sockets')(io);
// send homepage
app.get('/', function(req, res) {
// handle root requests res.sendFile(path.join(__dirname, '../../public/templates/index.html'));
app.get('/', function(req, res, next) {
res.sendFile(path.join(__dirname, '/../views/index.html'));
}); });
// public folder serves static content // public folder serves static content
app.use('/', express.static('public')); app.use('/', express.static(path.join(__dirname, '../../public')));
Executable → Regular
+2
View File
@@ -6,6 +6,8 @@
"dependencies": { "dependencies": {
"debug": "^2.1.3", "debug": "^2.1.3",
"express": "^4.12.3", "express": "^4.12.3",
"grunt": "^0.4.5",
"grunt-browserify": "^3.7.0",
"mineflayer": "^1.1.0", "mineflayer": "^1.1.0",
"socket.io": "^1.3.5" "socket.io": "^1.3.5"
}, },
@@ -22,7 +22,7 @@
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="/js/lib/socket.io.js"></script> <script src="/lib/socket.io.js"></script>
<script src="/js/app.js"></script> <script src="/js/app.js"></script>