Quantcast
Channel: Eureka! » HTML5
Viewing all articles
Browse latest Browse all 12

Gulp – Handle page reload in gulp-connect using connect-history-api-fallback

$
0
0

Page reload doesn’t work after enabled the html5mode. We have to rewrite the url and it could be easily done by using a middleware for the connect server.

gulpfile.js

var connect            = require('gulp-connect');
var historyApiFallback = require('connect-history-api-fallback');

gulp.task('connect', function() {
  connect.server({
    middleware: function(connect, opt) {
      return [ historyApiFallback({}) ];
    }
  });
});

 

Done =)

Reference: GitHub – bripkens/connect-history-api-fallback


Filed under: Web Development Tagged: Gulp, HTML5

Viewing all articles
Browse latest Browse all 12

Trending Articles