Prevent Shopify from removing CSS comments

NegativeSpace
Excursionist
14 2 5

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?

0 Likes
LitExtension
Shopify Partner
860 99 158

Hi @NegativeSpace

You can try with this snippet:

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

Hope this helps.

LitExtension - Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
0 Likes
NegativeSpace
Excursionist
14 2 5

Hi LitExtension,

That is currently what I have.

0 Likes