Prevent Shopify from removing CSS comments

NegativeSpace
Shopify Partner
18 3 6

I have a main CSS file that I compile locally with inline source maps while I'm working on development themes. I had noticed that my CSS file was loading into the browser without the source maps and that the asset_url filter was adding 

 

 

enable_css_minification=1&

to the URL which was removing any comments from the CSS file and that if I used

| remove: 'enable_css_minification=1&'

 

after the asset_url filter it would not remove my commented source map. However, seems like Shopify changed this to just happen always without using the URL parameter 😠

 

Does anyone know a way to prevent Shopify from removing the CSS comments?

Replies 2 (2)

LitExtension
Shopify Partner
4860 1001 1135

Hi @NegativeSpace

You can try with this snippet:

<link rel="stylesheet" href="{{ 'styles.css' | asset_url }}">

Hope this helps.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
NegativeSpace
Shopify Partner
18 3 6

Hi LitExtension,

That is currently what I have.