-->

AsseticBundle removed from all the Symfony's v

2019-01-29 14:10发布

问题:

I wanted to know why AsseticBundle has been removed from all the versions of Symfony.

I looked everywhere and I don't found any site talking about this news that began for some weeks.

Initially, I thought they deleted this Bundle because there is a security flaw that will take a few days to be repaired.

This Bundle is indisponsable for including javascript and css file type from an external folder and I wanted to be sure if this Bundle wille be replaced by an another in Symfony or I should add this Bundle manually.

Thanks

回答1:

The AsseticBundle is not compatible/maintained with the new version of the framework (2.8/3.x).

See the tweet of Fabpot that asking: Honest question: is #Assetic still relevant for #Symfony 3.0?

And the PR remove AsseticBundle (you can find good discussion about for and against the removal of Assetic).

Check also this great article on Symfony and Asset Management that clarify and riassume all the discussion around.

Hope this help



回答2:

Although Symfony does not support assetic from versions 2.8 upwards, you can still install it by running:

composer require symfony/assetic-bundle

and then enable the bundle in your AppKernel.php like so:

new Symfony\Bundle\AsseticBundle\AsseticBundle()