How to use Autoprefixer with Symfony2

I am trying to integrate Autoprefixer into a Symfony2 workflow (with Assetic). My first thought was that Assetic already provided its support as a filter (e.g. UglifyCSS and others), so I tried this:

    {% stylesheets
        '@PrivateBundle/Resources/public/less/bootstrap/bootstrap.less'
        '@PrivateBundle/Resources/public/less/private.less'

        filter='less,cssrewrite,autoprefixer,?uglifycss' 
    %}
        <link rel="stylesheet" href="{{ asset_url }}">
    {% endstylesheets %}

But that did not work.


The only alternative I could find was netzmacht / assetic-autoprefixer , but I could not get it to work.

I installed autoprefixer globally (via sudo npm install -g autoprefixer) and also installed kriswallsmith / assetic (which, I believe, is different from the assembler supporting Autoprefixer) using the composer, but after that I could not find the binary file that I need for the file parameters.yml.

- github, autoprefixer, , assetic-autoprefixer, . .

-, - ? Autoprefixer ( ) Symfony Assetic?

+4
1

- . , autoprefixer , , , assetic-autoprefixer ( ) .

, autoprefixer autoprefixer-cli, , "" .

sudo npm install autoprefixer-cli --save

parameters.yml. :

assetic:
    autoprefixer:
        bin: %kernel.root_dir%/../node_modules/autoprefixer-cli/autoprefixer-cli
+4

Source: https://habr.com/ru/post/1626348/


All Articles