Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[AsseticBundle] fixed formula caching system #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
2 commits merged into from
Feb 25, 2011
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[AsseticBundle] added resources to the routing loader
now the router will be aware of any changes assetic is aware of
  • Loading branch information
kriswallsmith committed Feb 25, 2011
commit d4db5319c821c8769771567ff6ea2d208e3bcb28
9 changes: 7 additions & 2 deletions 9 src/Symfony/Bundle/AsseticBundle/Factory/FileResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\AsseticBundle\Factory;

use Assetic\Factory\Resource\ResourceInterface;
use Assetic\Factory\Resource\FileResourceInterface;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Component\Templating\Loader\LoaderInterface;

Expand All @@ -20,7 +20,7 @@
*
* @author Kris Wallsmith <kris.wallsmith@symfony-project.com>
*/
class FileResource implements ResourceInterface
class FileResource implements FileResourceInterface
{
protected $loader;
protected $parser;
Expand Down Expand Up @@ -56,6 +56,11 @@ public function getContent()
return $this->loader->load($this->getTemplate())->getContent();
}

public function getPath()
{
return $this->path;
}

protected function getTemplate()
{
if (null === $this->template) {
Expand Down
20 changes: 18 additions & 2 deletions 20 src/Symfony/Bundle/AsseticBundle/Routing/AsseticLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

namespace Symfony\Bundle\AsseticBundle\Routing;

use Assetic\AssetManager;
use Assetic\Factory\LazyAssetManager;
use Assetic\Factory\Resource\FileResourceInterface;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

Expand All @@ -37,14 +39,28 @@ class AsseticLoader extends Loader
{
protected $am;

public function __construct(AssetManager $am)
public function __construct(LazyAssetManager $am)
{
$this->am = $am;
}

public function load($resource, $type = null)
{
$routes = new RouteCollection();

// resources
foreach ($this->am->getResources() as $resource) {
if (!$resource instanceof \Traversable) {
$resource = array($resource);
}
foreach ($resource as $r) {
if ($r instanceof FileResourceInterface) {
$routes->addResource(new FileResource($r->getPath()));
}
}
}

// routes
foreach ($this->am->getNames() as $name) {
$asset = $this->am->get($name);

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.