I'm sure there's a reason for loading some Slick library files by slick_library_info_alter(), but this is kinda problematic if someone tries to use the library for custom slick usage (by attach_library)?

Isn't it possible to define those files also as a library in the slick.libraries.yml and attach the whole library in the slick_library_info_alter()?

My main problem here is the "libraries/slick/slick-theme.css", it's not present in any defined library at all, so I'm not able to load it. If i add it in the theme, it will be loaded twice if my custom slider appears together with any regular slick slider.

Comments

thomas.frobieter created an issue. See original summary.

thomas.frobieter’s picture

Title: Not able to load the slick library files by attach_library » Not able to load some slick library files (slick-theme.css) by attach_library
gausarts’s picture

It is named slick/slick.css
https://git.drupalcode.org/project/slick/-/blob/8.x-2.x/src/SlickSkinMan...

Is that what you want?

Two reasons:

  • I was testing hook_library_info_build() with separate definitions from regular .yml file. Kind of core feature testings. Many things were new at D8 by then. I need to learn them. That is why you only see this particular file alone as being separated. Aside I needed more direct reference as a quick reminder for this particular change in the same file to disable it on the fly at Slick UI page as seen here:
    https://git.drupalcode.org/project/slick/-/blob/8.x-2.x/src/SlickSkinMan...
  • It was a feature request to disable skin and and "non-required" assets until required. Putting them on the same file make it easier to track and work with.

BTW, as long as you are defining a skin, at least a blank useless one named "Default", it will be included automatically, unless you disable it at Slick UI page for inclusion in the first place. Can you verify that option is ON?

No need to load or call it directly as long as a skin is defined:
https://git.drupalcode.org/project/slick/-/blob/8.x-2.x/src/SlickSkinMan...

thomas.frobieter’s picture

Status: Active » Closed (works as designed)

Helpful as always!

Defining the "Default" skin did the trick (:

Thank you so much and have a nice weekend!

PS: Using

{{ attach_library('slick/slick.css') }}

also works perfectly fine.

thomaswalther’s picture

Thanks @thomas.frobieter

I had the problem on another page with an included view.

In my view I changed the format settings:

  • Label "Skin main": Set to Default

settings in view