Asset Pipeline/Framework for PHP

后端 未结 1 1521
伪装坚强ぢ
伪装坚强ぢ 2021-02-14 04:58

Background

I am working on \"modernizing\" a pre-existing PHP-driven website. This website started out as a static website with a few php methods. It now has a mobile

相关标签:
1条回答
  • 2021-02-14 05:35

    Liek hakre said, Assetic works out of the box. You do not need any templating system (Twig, Smarty...) for it works.

    With a templating system, Twig is the best because, like hakre said, it's strongly implemented. However, it's not that diffucult to integrate it into any other template system (I quickly wrote a Smarty plugin for personnal use, it works well).

    Finaly Assetic does anything you need :

    • Combine JS/CSS : done with the AssetCollection class (has show here)
    • Minify : here you'll use the filters Assetic provides : CssMin, JsMin, JsMin+, Google Closure Compiler, you've got the choise. There even are image fitler for image optimization (mainly quality lossless size reduction)
    • Cache : Assetic has a cache system so you don't have to create one by yourslef.

    The last advantage that goes to Assetic is that it's the one used by default in Symfony2, which is, imo, one of the best PHP framework lately, so it proves that Assetic is a good choice.

    Only problem I had so far using Assetic out of Symfony was the lack of documentation (the usage of the CssRewriteFilter in my case) but good understanding of the source code often helps getting how it's supposed to work.

    0 讨论(0)
提交回复
热议问题