verbb / snipcart

A Craft CMS plugin to integrate with Snipcart.
Other
21 stars 9 forks source link

CSS styles don't load #10

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello Matt,

I'm integrating the cartSnippet into my templates, but it's missing the styles. In your cart-js.twig I can see {% if includeStyles -%}, but how and where would I trigger this so that the CSS gets loaded/not loaded?

I can read in the docs that cartSnippet(false) suppresses jQuery. Is there another parameter dealing with Snipcart styles?

Best regards Mike

mattstein commented 5 years ago

This might be another documentation issue @mikewink. cartSnippet can take three arguments: includejQuery boolean, onload string added as a value to the script's onload property, and that includeStyles boolean. If includeStyles is true, <link href="https://cdn.snipcart.com/themes/2.0/base/snipcart.min.css" rel="stylesheet" type="text/css" /> will rendered immediately below the script tag.

If that makes sense I'll just update the docs!

ghost commented 5 years ago

Ahh makes total sense. Thank you, Matt. :)

mattstein commented 5 years ago

Heads up @mikewink: I'm going to change the includeStyles default so that the base stylesheet is included. This should make initial setup more intuitive, as most will probably want to have a look at the cart before customizing it.

mattstein commented 5 years ago

Updated in 1.0.5 and noted in the updated docs.

I'm also pretty sure I didn't forget any commas this time. :)