Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Parser breaks on common templating syntax #29

@Lixivial

Description

@Lixivial

We use Liquid to render our HTML for various media contexts. Part of our workflow has our design teams trying to provide common logic assignments to various parts of the HTML, including css. So they sometimes tend to use a placeholder variable in CSS.

Something like the following is a common use case:

.someClass { color: {{ some_placeholder }} }

In these cases, the parsing regex chokes on encountering unexpected {{ }} since they're not valid CSS syntax. I've looked through the code and produced the following regex adjustment and test case. This regex goes out of its way to maintain the existing behavior and not require code changes in css.js and fix the underlying problem of {{ }}.

https://regex101.com/r/t99mX4/1/

In addition, I've created a fork and am assembling a PR with more unit tests to cover this case. It doesn't cover some of the other issues filed here, like an empty @media query, but certainly could be expanded to do so with a bit of further refinement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions