bezoerb / generator-grunt-symfony

[DEPRECATED] Yeoman generator that scaffolds out a Symfony PHP app including Browsersync, various CSS preprocessors, RequireJS, jspm, webpack and Service Worker
33 stars 5 forks source link

Symfony Routes not loaded in BrowserSync server #192

Open FossPrime opened 8 years ago

FossPrime commented 8 years ago

Any idea how to make the LiipImagineFilter symfony component work with grunt serve?

It seems the BrowserSync server needs to load the route...

route details:

+--------------+-----------------------------------------------------------------+
| Route Name   | liip_imagine_filter                                             |
| Path         | /media/cache/resolve/{filter}/{path}                            |
| Path Regex   | #^/media/cache/resolve/(?P<filter>[A-z0-9_\-]*)/(?P<path>.+)$#s |
| Host         | ANY                                                             |
| Host Regex   |                                                                 |
| Scheme       | ANY                                                             |
| Method       | GET                                                             |
| Requirements | filter: [A-z0-9_\-]*                                            |
|              | path: .+                                                        |
| Class        | Symfony\Component\Routing\Route                                 |
| Defaults     | _controller: liip_imagine.controller:filterAction               |
| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler         |
+--------------+-----------------------------------------------------------------+

It seems that when BrowserSync detects a .jpg, it bypasses the router... curious.

FossPrime commented 8 years ago

To add LiipImagineBundle support just add the route to browsersync.js this should be good enough.

if (!/\.\w{2,}$/.test(obj.pathname)
                            || /\.php/.test(obj.pathname) 
                            || /media\/cache\/resolve/.test(obj.pathname)
                        )

Some requests are routed others are not... by default only php requests are routed. I'll leave this open to see if someone can better convert the ?P<filter> part of its funky route regex.