Which code snippet correctly includes a Sass file named theme.scss in a Shopify theme?

Prepare for the Shopify Theme Development Certification Exam. Study with flashcards, multiple choice questions, hints, and explanations. Be exam-ready!

The correct approach to include a Sass file, such as theme.scss, in a Shopify theme is through the use of Liquid filters to ensure the appropriate processing and loading of the asset. In this context, when a Sass file is compiled, it typically generates a corresponding CSS file that is served to the browser.

Using the path and methodology defined in Shopify's asset management system, the proper way to include the compiled output of a Sass file in your theme is to reference the generated CSS file.

In practice, theme.scss will be processed automatically by Shopify, resulting in a theme.css file in the assets folder. Therefore, referencing theme.scss.css directly would not access the right compiled file. Instead, utilizing asset_url in conjunction with stylesheet_tag is the correct method to link to the final CSS output that is generated from your Sass file.

Consequently, the snippet that is built correctly for this purpose utilizes the asset_url filter that points to the generated stylesheet correctly in its final output.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy