Skip to content

Ability to get/set AssetFactory root property #518

Open
wants to merge 1 commit into from

3 participants

@donataso

No description provided.

@stof
Collaborator
stof commented Oct 22, 2013

what is the use case for making it mutable ?

@donataso

I want to be able to specify different root paths for each collection in the same module when using AsseticBundle. Of course I could create a new AssetFactory for every collection, but I think that's a waste of resources.

@stof
Collaborator
stof commented Oct 22, 2013

and what is the use case for specifying a different root for each collection ?

@donataso

Let's say I have a package installed using composer in project//vendor/mymodule and it has some JS files.
I want to use jQuery and install it using composer (components/jquery) in project//vendor/components.
This way jQuery is outside the module and I'd have to specify a full path or a few of ../../ for assetic to take it. This configuration is unacceptable because it doesn't allow me to use one config for both of the following situations:

  • jQuery is installed in project/vendor/components/jquery
  • jQuery is installed in project/vendor/mymodule/vendor/components/jquery

In my case both of these should work without additional changes.

@kriswallsmith
Owner

Can you use the root option?

$asset = $factory->createAsset(..., [ 'root' => '...' ]);
@donataso

In that case I'd have to use absolute path and I need it relative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.