eZ Platform Discussions

Inject scss in admin


#1

Bonjour,

https://doc.ezplatform.com/en/2.3/guide/extending_ez_platform/#further-extensibility-using-components

I followed this part of the doc to inject a css style sheet into the admin.
It works very well.

Only this is… I need to inject scss depending on the siteaccess…

    my.components.my_link_component:
       parent: EzSystems\EzPlatformAdminUi\Component\LinkComponent
       arguments:
           #$href: '/bundles/my/css/admin.css' # OK
           $href: '/bundles/my/scss/sites/admin1/style.scss' # KO
       tags:
           - { name: ezplatform.admin_ui.component, group: 'stylesheet-head' }

In the front. To include the scss style I do this:

{% stylesheets filter="scssphp, cssrewrite" output="css/site_edb.css"
    "bundles/my/scss/sites/site1/style.scss" %}
    <link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
  • How to include style from a scss file?
  • How to include siteaccess dynamically in the $href patameter?

#2

I don’t know if injecting scss even works, but if you wish to inject pure CSS per siteaccess, you define the container parameters like this:

my_app.eng.admin_css_file: '/path/to/eng.css'
my_app.cro.admin_css_file: '/path/to/cro.css'

And then just inject them with:

my.components.my_link_component:
   parent: EzSystems\EzPlatformAdminUi\Component\LinkComponent
   arguments:
       $href: '$admin_css_file;my_app$'
   tags:
       - { name: ezplatform.admin_ui.component, group: 'stylesheet-head' }