Trouble with Element API

I’ve created an element for our site and it works well.

But if I try to use the stylesheet as a style template, it doesn’t work. I think it might have to do with the script I’m using with the stylesheet (css-element-queries).

I tried to upload the plugin but I’m not allowed to uploads zip files. Any help would be appreciated. Thanks

Hi @jboulos,

Do you actively make changes to the styles? If so, try saving the the page first then check if the CSS styles take effect.

If the issue persists, kindly upload the zip file of the plugin you created and post the link to the file here in a Secure Note so that we can check it.

Thank you.

Sorry, my inital post was not too clear. What I meant is that when I use a style template, the template does not appear in the generated css.

The element I’ve made is very simple and does not change at all. Basically it is a static button for all intents and purposes. I’ve added it to the secure note in the first post.

The version I’ve attached is not using a style template. Instead, it just uses a stylesheet. Ideally I’d like the stylesheet to be the template.

I believe I’ve figured it out. It seems that if I have a CSS selector that isn’t .$_el, the generated CSS does not appear.

Hey Mina,

We are just glad that you have figured it out a way to correct the said issue.
Thanks for letting us know!

Best Regards.

I was just wondering if that is the intended behavior. Also, I found that if I have multiple of the same element on the page the CSS is not combined. Why is that?

Hey Mina,

Basing on the style code of the built-in elements, .$_el is used all throughout the code so I think it’s safe to say that it’s intentional. This is also required for CSS processing. See https://theme.co/docs/element-api-reference#style-templates

Regarding the CSS combination, in the previous versions, I see that the generated CSS codes are combined if 2 elements use the same value. Now, styles are individualized even for the built-in elements. I’ll forward this case to our development team and I’d recommend adding this in our Element API documentations.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.