What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

CSS in App Sections

CSS in App Sections

Appifiny
Shopify Partner
166 2 54

We are just getting started with the new sections architecture.

In the documentation for app sections, {% stylesheet %}  is not permitted.

What is the recommended way to add CSS to an app section.

Should we include it in <style></style> in the app section liquid code?

Or should we create a CSS file and insert it in the assets folder and then load it in the theme. This would still get left behind on app uninstallation though right?

Thanks in advance,

Asa

Try the best recent order app for Shopify free for 7 days: https://apps.shopify.com/recently
Replies 3 (3)

Appifiny
Shopify Partner
166 2 54

Any advice on this @Liam?

Try the best recent order app for Shopify free for 7 days: https://apps.shopify.com/recently

ThomasBorowski
Shopify Partner
803 71 242

It seems the only option is to include CSS within <style></style> tags and append -{{section.id}} to styles that are user-configurable via the theme editor so they only apply to the respective section/instance.

★ Smart Upgrades, Tips and Tutorials for Shopify themes: cartpunk.com
Did my solution work? Help other Community members easily find the correct solution and apply it to their own stores by marking it as the Accepted Solution and giving it a Thumbs Up
Appifiny
Shopify Partner
166 2 54

I thought this was probably the case.

It seems like Shopify have only considered part of the problem with theme sections.

There needs to be a method of bundling assets that are automatically removed on app uninstallation.

 

Try the best recent order app for Shopify free for 7 days: https://apps.shopify.com/recently