Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LESS Scanner #150

Open
thybzi opened this issue Jul 26, 2013 · 0 comments
Open

LESS Scanner #150

thybzi opened this issue Jul 26, 2013 · 0 comments

Comments

@thybzi
Copy link

thybzi commented Jul 26, 2013

Please add a scanner for one more CSS preprocessor named LESS: http://lesscss.org

Like SCSS (see #137, #93), LESS has CSS-like syntax with some specific "extensions".

CSS syntax highlighting isn't suitable for LESS, because it doesn't concern these "extensions", e.g.:

  1. Ampersands (&, meaning "parent selector") are destructed (shown as x%x%)
  2. Subselectors are not highlighted as selectors
  3. Variables, mixins and functions aren't accounted
  4. LESS-style comments (// this kind, I mean) are ignored
  5. And so on

Example of LESS code:

/* CSS-style comment for mixin */
.border-radius(@value: 5px) {
    -moz-border-raduis: @value;
    -webkit-border-raduis: @value;
    border-raduis: @value;
}

.parent {
    @base-color: #ffc; // variable (LESS-style comment)
    .border-radius(); // mixin call without params
    -ms-filter: 'progid:DXImageTransform.Microsoft.gradient(startColorstr=@{base-color},endColorstr=@{base-color})'; // string with variable interpolation

    & > .child {
        color: @base-color;
        .border-radius(); // mixin call without params and braces
        width: ~"expression(this.parentNode.offsetWidth + 'px')"; // syntax escaping
    }

    &.subclass {
        background-color: lighten(@base-color, 10%); // function call
        .border-radius(10px); // mixin call with params
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant