0

I am trying to include a CSS from a jQuery library that I have within Magento_Theme/web/js/libs/ folder, however, I am struggling to source a CSS file from within here?

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Magento_Theme/web/js/libs/slick/styles.min.css" />
    </head>
</page>

How can I do this? I can only seem to source css from within the root/web folder within my theme if I was to use:

<css src="css/styles.min.css" />

2 Answers 2

1

Got it working :)

<css src="Magento_Theme::js/libs/slick/slick.css" />
1

I've never done this but give this a try:

<css src="Magento_Theme::js/libs/slick/slick.css" />

All I've done is remove web as it isn't required, and changed / to :: (that you noticed xD)

2
  • Thanks Ben, the above code didn't work but pointed me in the right direction :) I changed it to follow the same structure as adding blocks :) See my answer....
    – lky
    Jan 5, 2018 at 17:16
  • FML, I forget that the / should be :: at least once a week. I'll update this even though you've already fixed it.
    – Ben Crook
    Jan 5, 2018 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.