I've added slick.js to my website,there is no error log.

I put css in my_vendor/my_theme/web/css

But I don't think the css had been loaded,b/c when I open the developer tools,

there is no slick.css or slick-theme.css.

Now the page messed up.

Am I missing something ?


I try to copy all the css from slick.css or slick-theme.css to my css.file,and it still not showing the style.

Any idea? :(

| improve this question | | | | |
  • Do you have a specific page you would like to load the css on, such as catalog/product/view, or do you want it to load on all pages? – dmatthew Mar 1 '17 at 19:14
  • Right now just for homepage. – mio Mar 2 '17 at 1:54

You probably have not included your css files in any page layouts. You can add css files to pages by adding the css file to a layout xml file.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <css src="Vendor_Module::path/to/slick.css" />

Something similar to this: https://github.com/magento/magento2/blob/develop/app/code/Magento/Swatches/view/frontend/layout/catalog_category_view.xml#L10

| improve this answer | | | | |
  • I think I gave the wrong src path ,I just make it work by putting the css in own theme.css .Thanks , now I'll follow your way and try to separate it. – mio Mar 3 '17 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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