This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Zmove
Zmove

Hello,

I have a layout page with a header partial declared like this :

{% partial 'header' %}

In my header partial, I embed some styles using the {% put styles %} tag

{% put styles %}
  <link href="{{ 'assets/vendor/hamburgers/hamburgers.min.css'|theme }}" rel="stylesheet" />
{% endput %}

But the CSS as not added...

The strange things is that I also add some javascript in that partial like this :

 <script>
     $(document).ready(function() {
       alert('test');
     });
 </script>

And the javascript perfectly works.

Any ideas about that problem ? Why can I put some JS using {% put scripts %} but no CSS using {% put styles %}

thanks

alxy
alxy

Just to be sure: In your Layout, you somewhere put the {% styles %}-tag right?

Troiscent
Troiscent

Hello,

Yes, the {% styles %} tag is in my layout.

After some more teste, I noticed that if I put the {% styles %} tag after the partial that {% put styles %}, it's correctly added.

But if the {% styles %} tag is added before the partial, it's not added, and that's probably why it works with the {% scripts %} tag, because it's added at the end, just before the tag.

Is it a bug or normal behavior ? Maybe we can use {% put %} tag only in partial that are in a page (not in a layout).

josh208
josh208

A little late to the party, but ran into the same challenge and figured out a work around. You can load a partial inside of your put styles tag, like...

{% put styles %}
{% partial 'header-style' %}
{% endput %}

Last updated

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.