Search code examples
backbone.jsgruntjspushstateyeoman

Yeoman backbonejs with pushstate causing issues with grunt-contrib-connect


I have a backbonejs application in my yeoman dev environment. My application uses pushstate, however this causes the connect server to issue 404s when the page is reloaded (via live reload) or when I try to directly access a url. This is somewhat annoying right now, as I have pushstate support working under an nginx proxy, but I would like to have this ability in my dev environment too.


Solution

  • I've been having a similar issue with my AngularJS application and Yeoman. I used the 'connect-modrewrite' middleware to rewrite all URLS that weren't pointing to specific resources. Found the solution here => https://ejd.dev/2013/05/31/angular-html5Mode-with-yeoman/