Skip to content

Instantly share code, notes, and snippets.

@PhoneDroid
Created April 19, 2023 09:20
Show Gist options
  • Select an option

  • Save PhoneDroid/2176ebd3e61f37dc48f56556ab3de495 to your computer and use it in GitHub Desktop.

Select an option

Save PhoneDroid/2176ebd3e61f37dc48f56556ab3de495 to your computer and use it in GitHub Desktop.
Shopify liquid stylesheet snippet
{%- liquid

    #
    #   Stylesheet Tag
    #

    #
    #   Imports:
    #
    #   @file
    #
    #       Name of the asset file 'Style' for 'assets/Style.css'
    #
    #   ?min
    #
    #       'Tablet' , 'Desktop'
    #
    #   ?max
    #
    #       'Phone' , 'Tablet'
    #

    assign link = file | append_to : '.css' | asset_url


    if min
        assign type = 'min'
    else
        assign type = 'max'
    endif


    case min

    when 'Tablet'
        assign pixel = 750

    when 'Desktop'
        assign pixel = 1024

    endcase


    case max

    when 'Phone'
        assign pixel = 749

    when 'Tablet'
        assign pixel = 1023

    endcase

-%}


<link

    media = 'screen and ( {{ type }}-width : {{ pixel }}px )'
    href = '{{ link }}'
    rel = stylesheet

>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment