Skip to content

Instantly share code, notes, and snippets.

@broncha
Created February 6, 2015 10:44
Show Gist options
  • Save broncha/7f0055a04e4dcfc2074b to your computer and use it in GitHub Desktop.
Save broncha/7f0055a04e4dcfc2074b to your computer and use it in GitHub Desktop.
assetic dumper
$assetFactory = new AssetFactory($themePath);
$assetFactory->setDebug(false);
$fm = new FilterManager();
$fm->set('cssrewrite', new CssRewriteFilter());
$assetFactory->setFilterManager($fm);
$am = new LazyAssetManager($assetFactory);
$twig->addExtension(new AsseticExtension($assetFactory, $userPublicPath));
$am->setLoader('twig', new TwigFormulaLoader($twig));
$finder = new Finder();
$finder
->files()
->in($themePath)
->exclude('css')
->exclude('js')
->exclude('images')
->name("*twig")
;
foreach($finder as $template){
$resource = new TwigResource($loader, $template->getFileName());
$am->addResource($resource, 'twig');
}
$writer = new AssetWriter($app.'/../web');
$writer->writeManagerAssets($am);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment