fixed grunt dev so pushstate routes now work ( 404 -> index.html)
This commit is contained in:
@@ -23,7 +23,16 @@ module.exports = function(grunt) {
|
||||
server: {
|
||||
options: {
|
||||
port: 3001,
|
||||
base: 'build'
|
||||
base: 'build',
|
||||
middleware: function(connect, options) {
|
||||
return [
|
||||
function(req, res) {
|
||||
var filename = 'build/' + req.url;
|
||||
if ((filename === 'build//') || !grunt.file.exists(filename)) filename = 'build/index.html';
|
||||
res.end(grunt.file.read(filename));
|
||||
}
|
||||
];
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -58,11 +67,14 @@ module.exports = function(grunt) {
|
||||
},
|
||||
force: true
|
||||
},
|
||||
files: [
|
||||
{expand: true, flatten: true, src: ['build/ribica.bundle.js'], dest: 'build/'}
|
||||
]
|
||||
files: [{
|
||||
expand: true,
|
||||
flatten: true,
|
||||
src: ['build/ribica.bundle.js'],
|
||||
dest: 'build/'
|
||||
}]
|
||||
}
|
||||
},
|
||||
},
|
||||
concat: {
|
||||
css: {
|
||||
src: [
|
||||
@@ -92,7 +104,7 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('default', []);
|
||||
grunt.registerTask('config-dev', ['config:dev', 'replace']);
|
||||
grunt.registerTask('config-prod', ['config:prod', 'replace']);
|
||||
grunt.registerTask('dev', ['browserify', 'config-dev','concat:css', 'concat:js', 'connect:server:keepalive']);
|
||||
grunt.registerTask('dev', ['browserify', 'config-dev', 'concat:css', 'concat:js', 'connect:server:keepalive']);
|
||||
grunt.registerTask('build', ['browserify', 'config-prod', 'concat:css', 'concat:js']);
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user