简体   繁体   中英

Assetic doesn't work Symfony 3

I have a application with two different base twig files. One is for the main application and the other is for the docs for the application.

In both base files i use different css files. In one base it works and in a other one it does not work.

This is the working base file

     {% stylesheets output='css/compiled/main.min.css'
        '@CoreBundle/Resources/public/css/feedback.css'
        '@CoreBundle/Resources/public/css/general.css'
        '@CoreBundle/Resources/public/css/portal.css'
        '@UserBundle/Resources/public/css/*.css'
     %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}

and this is the base file that does not work

    {% stylesheets output='css/compiled/knowledge.min.css'
        '@CoreBundle/Resources/public/css/knowledgeCenter.css'
    %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}

I have in mijn assetic.yml (which is included in my config.yml)

assetic:
debug:          "%kernel.debug%"
use_controller: '%kernel.debug%'
read_from:      "%kernel.root_dir%/../web"
bundles:        [ ]
#java: /usr/bin/java
filters:
    scssphp:
        formatter: 'Leafo\ScssPhp\Formatter\Compressed'
    uglifyjs2:
        bin: /usr/local/bin/uglifyjs
    uglifycss:
        bin: /usr/local/bin/uglifycss
    cssrewrite: ~
    #closure:
    #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
    #yui_css:
    #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

The folder @CoreBundle/Resources/public/css looks the following

在此处输入图片说明

Note: the knowledgeCenter.css is compiled by phpstorm from scss Note: the .css file is not in the .scss file it is something that phpstorm shows

My console looks like this when i update the assets

在此处输入图片说明

As you can see it does not include the css i made in the public/css folder

I have tried the following

  • Cleaned all the cache and installed assets again with php bin/console

    (i tried these commands

    bin/console cache:clear

    bin/console cache:clear --env=prod

    bin/console assets:install web

    bin/console assetic:dump

    bin/console assetic:dump --env=prod

    )

  • Made a .css file instead of a .css file generated by phpstrom from scss
  • changed the output from the not working base stylesheet to 'css/compiled/main.min.css'

All the following things did not work

Thank you in advance !

The documentation here says like this. Maybe u forgot the filter options.

{% stylesheets filter="scssphp" output="css/app.css"
    "assets/scss/bootstrap.scss"
    "assets/scss/font-awesome.scss"
    "assets/css/*.css"
%}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM