generator-gulp-angular icon indicating copy to clipboard operation
generator-gulp-angular copied to clipboard

BrowserSyncSpa and html 5 mode issue

Open dmitriynosenko opened this issue 11 years ago • 3 comments

Hello. Today I migrated to latest version of Generator Gulp Angular and I found one interesting issue. I am using html 5 mode in my app. In the same time I am using the timezoneJS client lib for converting timezones. This lib requires olson timezone files and none of this files has extension. That's why in prev versions of gulp generator I used proxyMiddleware with additional check:

if (req.url.indexOf('/assets/tz/') >= 0) {
        next();
} else if (/\.(html|css|js|png|jpg|jpeg|gif|ico|xml|rss|txt|eot|svg|ttf|woff|woff2|cur)(\?((r|v|rel|rev)=[\-\.\w]*)?)?$/.test(req.url)) {
        next();
} else {
        modRewrite(['!\\.\\w+$ /index.html [L]'])(req, res, next);
}

It works perfect until I migrated to latest version. The middleware worked, but instead timezone files I received the index.html page. After some tests I found that problem in browser sync spa. When I commented

browserSync.use(browserSyncSpa({
   selector: '[ng-app]'// Only needed for angular apps
}));

the errors gone. Maybe I should use different settings or create this issue in browser sync spa project?

dmitriynosenko avatar Mar 31 '15 19:03 dmitriynosenko

browser-sync-spa is added by https://github.com/Swiip/generator-gulp-angular/pull/315 to fix HTML5 mode. Maybe now he isn't necessary

zckrs avatar Apr 01 '15 08:04 zckrs

Yes, it gives ability to use HTML5 mode without proxies, but in the same time I can't manage files without extensions because it thinks that this is route and not resource.

dmitriynosenko avatar Apr 01 '15 11:04 dmitriynosenko

:tada: Just released v0.12.0 :tada: Your issue should be fixed. I close but if you can retry your case with a new fresh install of generator you are welcome. Any feedback would be appreciated (positive comments too ^_^).

zckrs avatar Jun 18 '15 16:06 zckrs