Search code examples
sassliquidcodekitlibsass

Sass Preprocessors - Can They Ignore Specific Patterns?


I'm using CodeKit to compile .scss using libsass. In these files I want to include some Liquid templating

.some-class {
    color: {{ settings.color_primary }};
}

Throws and error though. Is there a way to tell the preprocessor to let this pass through?

Thanks


Solution

  • Use sass interpolations to insert anything literally

    .some-class {
        color: #{ "{{ settings.color_primary }}" };
    }
    

    You may also use a helper function for nicer syntax

    @function liquid-var($name) {
        @return #{ "{{ " + $name + " }}" };
    }
    
    .some-class {
        color: liquid-var("settings.color_primary");
    }