<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joseph Bergdoll on Medium]]></title>
        <description><![CDATA[Stories by Joseph Bergdoll on Medium]]></description>
        <link>https://medium.com/@josephbergdoll?source=rss-fe6aca6de00f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*LQMi04lratmJMizp.jpeg</url>
            <title>Stories by Joseph Bergdoll on Medium</title>
            <link>https://medium.com/@josephbergdoll?source=rss-fe6aca6de00f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 19:54:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@josephbergdoll/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Writing Sass for Shopify]]></title>
            <link>https://medium.com/@josephbergdoll/writing-sass-for-shopify-22c7568dd8f2?source=rss-fe6aca6de00f------2</link>
            <guid isPermaLink="false">https://medium.com/p/22c7568dd8f2</guid>
            <dc:creator><![CDATA[Joseph Bergdoll]]></dc:creator>
            <pubDate>Mon, 18 Aug 2014 14:48:15 GMT</pubDate>
            <atom:updated>2015-04-04T00:06:48.504Z</atom:updated>
            <content:encoded><![CDATA[<h2>Writing Sass for Shopify without fucking up your normal workflow.</h2><p>If you’ve ever done any Shopify theme development, you know that you’re gonna be writing with <a href="https://github.com/Shopify/liquid"><strong>Liquid</strong></a>. While Liquid is great for template files, it’s not exactly the most flexible solution for stylesheets. As the Liquid docs are very good at communicating, the css/scss @import function doesn’t work in .scss.liquid files.</p><p>This means that your single main.scss.liquid file must contain <em>every</em> CSS declaration you intend to apply to your theme, as well as any and all helpers (resets, mixins, variables) too. And even if the @import function <strong>did</strong> work, you would have to have every single one of your .scss.liquid files in the <em>/assets/</em> folder of your theme, or else it won’t be uploaded to the Shopify CDN.</p><h3>Ayy, lmao.</h3><p>You win, Shopify. But luckily, your way isn’t the only way!</p><p>For my current Shopify project, I wanted to do things the way that I’m used to doing them on every other dev project I’ve worked on. Shopify theme dev can be a <strong>swift kick to the feels</strong> for <a href="http://www.joshuawinn.com/shopifys-limitations-and-weaknesses-in-theme-development/">other</a> <a href="http://code.tutsplus.com/articles/lessons-learned-from-building-shopify-themes--net-27593">reasons</a> than just the file structure headaches I mentioned above. So, if we can eliminate one frustration, why not?</p><p>If you’re writing Sass, you already know <a href="http://thesassway.com/beginner/how-to-structure-a-sass-project">how to structure a Sass project</a>. Now let’s do this in Shopify. I created a <em>/stylesheets</em> directory in the root directory of my Shopify theme with my usual Sass file structure ( <em>/globals</em>, <em>/components</em>, <em>/pages</em>, etc) inside. Whether you’re using the <a href="https://github.com/Shopify/shopify_theme"><strong>Shopify Theme Gem</strong></a> to watch your theme folder from the command line, or their <a href="https://apps.shopify.com/desktop-theme-editor"><strong>Desktop Theme Editor</strong></a> GUI, this folder isn’t going to be uploaded because remember, Shopify wants all your styles in one file. That’s okay, because all you need to do is set whatever SCSS compiler (like <a href="https://incident57.com/codekit/">CodeKit</a> or <a href="http://gruntjs.com/">Grunt</a>) you are using to output your main.scss file with all of your imports to a main.scss.liquid file in the theme’s /assets/ folder.</p><p>yourtheme/stylesheets/main.scss → <strong>yourtheme/assets/main.scss.liquid</strong></p><p>Easy, eh? Yeah, dude. Sooooo easy.</p><h3>But what about assets?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*8gnmR7iD2cWBeVNkwfULWw.png" /><figcaption>dat asset</figcaption></figure><p>A benefit to writing everything in the .liquid format is the ability to use Shopify’s CDN asset URL’s without having to actually figure that shit out. That’s where these two little mixins come in handy. (<a href="https://github.com/josephbergdoll/shopify-scss-asset-helper">github repo</a>)</p><pre><strong>@mixin font-file(</strong>$asset-font-name<strong>)</strong> {<br> <strong>src:</strong> url(https://medium.com/%E2%80%98%20%7B%7B%20%E2%80%9C#{$asset-font-name}.eot%E2%80%9D%20|%20asset_url%20}}%20%E2%80%98);<br><strong> src:</strong> url(https://medium.com/%E2%80%98%20%7B%7B%20%E2%80%9C#{$asset-font-name}.eot%E2%80%9D%20|%20asset_url%20}}%20?#iefix%20%E2%80%98) format(“embedded-opentype”),<br> url(https://medium.com/%E2%80%98%20%7B%7B%20%E2%80%9C#{$asset-font-name}.woff%E2%80%9D%20|%20asset_url%20}}%20%E2%80%98) format(“woff”),<br> url(https://medium.com/%E2%80%98%20%7B%7B%20%E2%80%9C#{$asset-font-name}.ttf%E2%80%9D%20|%20asset_url%20}}%20%E2%80%98) format(“truetype”),<br> url(https://medium.com/%E2%80%98%20%7B%7B%20%E2%80%9C#{$asset-font-name}.svg%E2%80%9D%20|%20asset_url%20}}%20%E2%80%98) format(“svg”);<br>}</pre><pre><strong>@mixin background-file(</strong>$asset-image-with-extension<strong><em>) </em></strong>{<br> <strong>background-image: </strong>url(https://medium.com/%E2%80%98%20%7B%7B%20%E2%80%9C#{$asset-image-with-extension}%E2%80%9D%20|%20asset_url%20}}%20%E2%80%98)<br>}</pre><p>The first is used for linking to webfont files, if you’re putting them in the <em>/assets/</em> folder. The second is used for background images. Obviously this can be changed to do whatever you want using Shopify’s liquid tags and interpolating the values you pass through your mixins.</p><p>Anyways – hope this helps. Thanks for reading, be well, and ✌.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22c7568dd8f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>