Duplicate code when inserting multiple equal sections

Topic summary

Main issue: In Shopify’s Dawn theme, inserting the same section multiple times duplicates its CSS (and possibly JavaScript) because each section includes its own assets. The concern is potential performance impact, especially for reused components (price, card, list). A global stylesheet is considered to reduce duplication but could load unused code.

Another participant confirms this pattern appears regularly in Dawn and wonders if that implies it’s acceptable. They ask whether Shopify’s CDN deduplicates or optimizes repeated stylesheets; no documentation or confirmation is found.

Technical context: Dawn is Shopify’s reference theme. Sections can self-include assets, so repeating sections can render identical style blocks multiple times in the page.

Performance implications remain unclear; no benchmarks or official guidance are provided. The trade‑off between code duplication and shipping unused CSS is noted but not resolved.

Outcome: No concrete solution or consensus is reached. Key open questions include CDN-level deduplication and recommended asset-loading patterns for repeated sections. An image is referenced but not essential to understanding.

Summarized with AI on February 23. AI used: gpt-5.

Hello everyone, good day. Working with the Dawn theme, I realized that when inserting a section more than once, the CSS code is duplicated. I understand that this happens because the section calls its own CSS and JavaScript.

My question is is this a serious performance problem or not? Especially in the sections that reuse certain components such as: price, card, list, etc.

And if someone has found a way to minimize the problem or fix it. It only occurs to me to have a global file that is called site-wide, but it would be calling potentially unused code.

2 Likes

I’m curious about this myself. I noticed they regularly do this in the Dawn theme with certain components, and as far as I can tell the stylesheet would be included multiple times on the page. I would assume if they do it in Dawn then it’s considered okay?

Do Shopify optimise this with their CDN in any way, however? I can’t find any documentation on this.