Kevmon
Kevmon

Reputation: 1005

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

Upvotes: 1

Views: 303

Answers (1)

Marcel Greter
Marcel Greter

Reputation: 275

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");
}

Upvotes: 2

Related Questions