Run CSS file through Twig when using {% stylesheets %} tag in Twig with Symfony2

前端 未结 2 2120
甜味超标
甜味超标 2021-02-14 07:01

I\'m including CSS stylesheets in my template like so:

{% stylesheets
    \"@SomeBundle/Resources/assets/css/default.css.twig\"
    \"@SomeBundle/Resources/asset         


        
2条回答
  •  太阳男子
    2021-02-14 07:32

    Most common things you'd want to do by processing CSS with Twig should be possible with Sass, LESS or similar, which can be applied as Assetic filters. First tutorial Google threw up was this one: http://alexandre-salome.fr/blog/Sass-Compass-Assetic-In-Ten-Minutes

    Admittedly, that doesn't look like much help if you're unable to run Ruby/Node.js/whatever on the production server you're developing for, but it should be possible to create an Assetic filter based on one of the PHP ports of Sass/LESS (assuming they're any good) if that's the case.

提交回复
热议问题