Skip to content

Instantly share code, notes, and snippets.

@delorenj
Created June 22, 2012 15:41
Show Gist options
  • Save delorenj/2973561 to your computer and use it in GitHub Desktop.
Save delorenj/2973561 to your computer and use it in GitHub Desktop.
compile fos_js_routing_js callback into static js for use with assetic
<?php
require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel('stage', false);
$kernel->loadClassCache();
$response = $kernel->handle(Request::create('/js/routing?callback=fos.Router.setData'));
file_put_contents(__DIR__.'/../web/js/routes.js', $response->getContent());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment