Grunt url rewrite in angular app on reload page

Here's what the insert block in the Grunt file looks like:

livereload: { options: { open: true, middleware: function (connect, options,middleware) { var optBase = (typeof options.base === 'string') ? [options.base] : options.base; return [ [require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat( optBase.map(function(path){ return connect.static(path); })), connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect().use( '/app/styles', connect.static('./app/styles') ), connect.static(appConfig.app) ]; } } } 

However, if my URL has a '.' (period) in it, Grunt does not reload the page. I use HTML5 mode in my Angular app and it works great.

Can i find out which part

 require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat( optBase.map(function(path){ return connect.static(path); })) 

causes an error and how to fix it?

Note. It does not work only when reloading the page. The first time I visit a route, it works, and then if I click update, it fails.

+7
javascript gruntjs
source share

No one has answered this question yet.

See similar questions:

14
Html5 mode with grunt service not working

or similar:

2170
How to change the url without reloading the page?
609
How to reload a page using JavaScript
586
Updating the address bar with a new URL without a hash or reloading the page
48
How to use grunt-contrib-livereload?
45
How to use grunt server, how can I redirect all requests to root URL?
one
Angular 2 app running on iis does not return on reboot
one
Grunt-connect middleware for testing file downloads
0
How to redirect in javascript which is in corner app 5
0
grunt serves fine, but grumbles: dist gives strange behavior
0
Html 5 mode in corner application

All Articles