File transformations improve the developer experience by letting you write and maintain code using your preferred strategies and build tools, and ship compiled code that is optimized for browser runtime. For example, you might want to divide your stylesheets into multiple files, each scoped to a particular UI element, which makes them easier to maintain. However, loading a large number of small stylesheets is slower than loading one or two larger stylesheets. You can use file transformations to automate the process of combining these smaller, scoped stylesheets into fewer, larger bundles. You can transform files as part of a build process, and then upload your compiled code as a theme that can be accessed in the Shopify admin. Below are some examples of file transformations that theme developers might want to perform: | File transformation | Benefit | | --- | --- | | Custom file structure > Shopify theme file structure | Code maintenance flexibility | | SCSS > CSS | Write in SCSS, output Shopify-compatible CSS | | SVG > snippet | Include SVGs inline in HTML | | [PostCSS](https://github.com/postcss/postcss) transformations (e.g. Autoprefixer, cssnano, tailwindcss) | Linting, variables, transpiling, browser compatibility | | Section folders > section files | Build sections in separate Liquid, JS, CSS, and JSON files | | Automated calculation and inlining of critical styles | Avoid load-blocking CSS resources | | Optimized JavaScript bundles | Reduced load times, smaller file sizes | | JavaScript, CSS, and HTML minification | Reduced load times, smaller file sizes | If you want to perform transformations on your files, then you need to decide how you want to manage both the source code and the transformed, or compiled, code. To learn about the options, and which options can be used with Shopify tools, refer to [Version control best practices for Shopify themes](/docs/storefronts/themes/best-practices/version-control). You can also consider using [just-in-time (JIT) file transformations](#just-in-time-file-transformations) to reduce the need to track changes to compiled code. JIT transformations can deliver optimized dependencies and resources at runtime, allowing for a unified code base that doesn't need to be backfilled. ## Compiled code and merchant or app customizations After a theme is uploaded to Shopify, merchants can customize it using the [theme editor](/docs/storefronts/themes/tools/online-editor) or the [code editor](/docs/storefronts/themes/tools/code-editor). [Apps](/docs/apps/build) might also change the theme code through the `Asset` [REST Admin API resource](/docs/apps/build/online-store/asset-legacy). This can lead to situations where compiled code has been altered, but source code hasn't been updated. You might need to identify changes to the compiled code, and then manually backfill those changes into your source code so the changes persist the next time the code is compiled. This is a particular risk if you are a Partner or merchant developer who performs ongoing customizations to a merchant's theme. You should consider the impact of merchant or app customizations when planning your file transformation and [version control](/docs/storefronts/themes/best-practices/version-control) strategy. > Tip: > If you perform file transformations using [Just-in-time services](#just-in-time-file-transformations), then you don't need to backfill changes. ### Backfilling changes to compiled code When a change is made to a compiled file and the theme is [connected to GitHub](/docs/storefronts/themes/tools/github), then the change is added to the theme's GitHub repo as a commit. You can use this commit to identify and backfill merchant changes. The following is an example of identifying and backfilling a change to a theme that's connected to version control using [the Shopify GitHub integration](/docs/storefronts/themes/tools/github). #### Step 1: The developer writes source code and compiles it You create the following scoped JavaScript resources for a theme.