Symfony SassBundle not recognize the .yaml config

  Kiến thức lập trình

I am working on a Symfony App.
To optimize ressources at the loading, I made differents stylesheets. My main stylesheet is a .ccs template file that I reuse in most of my projects.

My others files are .scss files I include via AssetMapper when I need it. They basically set the style of specific .twig components.

screenshot of the folder “assets” in my working tree

{% extends 'base.html.twig' %}

{% block title %}Hello PublicController!{% endblock %}
{% block stylesheets %}
    <link rel="stylesheet" href="{{ asset('styles/insets.scss') }}">
{% endblock %}

My issue is : I can’t build my .scss stylesheets because SassBundle only want a single file “app.scss”.

PS C:Usersjuliewebweb-app-mairie> php bin/console sass:build --watch
[critical] Error thrown while running command "sass:build --watch". Message: "Could not find Sass file: "C:Usersjuliewebweb-app-mairie/assets/styles/app.scss""

In SassBuilder.php line 116:
                                                                                        
  Could not find Sass file: "C:Usersjuliewebweb-app-mairie/assets/styles/app.scss"  
                                                                                        

sass:build [-w|--watch]

So I tried to build with my external binary.
PS C:Usersjuliewebweb-app-mairie> sass /assets/insets.scss /assets/insets.css
Error :
Error reading ........assetsinsets.scss: Cannot open file.

And I finally tried to add path of my .scss files to the root config like mentioned in symfony doc.
BUT I have the same error thant at the start : the builder could not find the “app.scss”.
This not surprise me enought because I had to create the symfonycasts_sass.yaml file in config/packages myself. There is what I written :

# config/packages/symfonycasts_sass.yaml
symfonycasts_sass:
    root_sass:
        - '%kernel.project_dir%/assets/insets.scss'

I suppose it use a another config file but where… I searched a bit in vendor directory but I quickly lost my way.

So guys, do you know anything about this ***? Or do you have an other solution / advices for me?

New contributor

d3os is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT