Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Yeoman Server and Backbone/BBB pushState #468
Backbone Boilerplate is set up to use pushState, so there are no hashes in the URLs. When Yeoman Server tries to live-reload a BBB app, it triggers a 404 because the hash-less path isn't recognized.
This is fixable with Apache via
Is there a way to configure Yeoman for something similar to a mod_rewrite, or better yet, to check Apache rewrite rules before doing a live reload?
(Or if someone knows a better way entirely rather than
added a commit
Sep 16, 2012
Just hacked together a solution for this (see the referenced commit).
If you add a
The rules get applied in order, and it supports the [L] terminator.
@michael-cantera if you want to try it, you can pull my branch into your yeoman git repo (if you've cloned it down and installed that way), or if you installed it via npm, I think you'd need to follow the instructions for using yeoman from git master here: https://github.com/yeoman/yeoman/wiki/Additional-FAQ
referenced this issue
Sep 16, 2012
@addyosmani my pull-request hasn't modified the default gruntfile, but just added the relevant code to deal with the rewrite config in yeoman's cli/tasks/server.js
Of course happy to consider where or how this change gets made, but I can see it tripping quite a few people up as a smooth first experience with using yeoman and single page apps.
I can't seem to get Yeoman/Grunt to see the rewrite rule, even when using a regexp that's almost identical to the one @latentflip included in the docs:
(Note this example from the docs is slightly different from the one in this thread. I've tried them both and several variations.)
I assumed I didn't have the regexp correct until I stripped it down to be essentially the same as the example:
Not only is the hash not added, but the 404 error says Yeoman is still looking for
Could it be that
Just to confirm, I am working with @latentflip's modified version of
Any help is appreciated. Hoping it's not just a noob regexp problem. :)
Hi @michael-cantera. There seem to be a few issues:
Firstly, the example rule that is in the code comments in my fork is in fact wrong, and won't ever work, but the one I posted further up this thread should work. The omission is a leading slash before the url to match:
I am however a little confused as to what you want to do. If you are using pushState, why are you trying to redirect to urls with
Here's the use-case I was thinking you were looking for, is this not what you are after?
And since you want the same thing to work in development with yeoman you open this issue.
Is that what you are trying to do? Or am I missing something?