Trying to solve a dilemma with my Shopify theme.
Working on my Shopify theme, I find it frustrating that I have to constantly save my CSS changes, switch tabs, and reload the browser to see updates. While I know about the theme gem, it doesn't provide automatic reloading.
Therefore, I decided to create a Gulp task with the following steps:
- Detect changes in SCSS files
- Compile them into CSS
- Inject the changes using browser sync, which proxies the Shopify theme URL to a localhost address
The issue at hand is that Shopify instantly uploads changed assets to a CDN, causing the CSS file to load from a different domain. This makes it difficult for browser sync to recognize the file for injection.
So here's the main question:
If my theme preview URL is proxied to a local address like http://localhost:3000
and loads the CSS file from something like
https://cdn.shopify.com/s/files/1/0878/7368/t/2/assets/style.css?12713062062911383123
, can I instruct browser sync in Gulp to overwrite that specific file with the necessary changes for injection?
Hoping this all makes sense.