Giter Club home page Giter Club logo

Comments (2)

Krinkle avatar Krinkle commented on July 17, 2024

This is not compiling

@width: 960px;
.nav {
  width: @width / 3;
  color: #001 + #abc;
}
.body {
  width: 2 * @width / 3;
  font-family: "hel" + "vetica";
}

it give me this error

fatal error: ParseError: Unexpected input in anonymous-file-0.less on line 8, column 16
.body {
  width: 2 * @width / 3;
  font-family: \"hel\" + \"vetica\";
}

That's right. This kind of string concatenation is not supported by the Less standard. If you try the reference implementation in JavaScript, we see much the same error:

Both give the same result:

Parse error: Unrecognised input
Line 8:   font-family: "hel" + "vetica";

I suggest using e() and/or %() instead. Refer to the docs at https://lesscss.org/functions/#string-functions-e.

Example:

div {
  font-family: %("%s%s", "hel", "vetica");
  font-family: e(%("%s%s", "hel", "vetica"));
}
div {
  font-family: "helvetica";
  font-family: helvetica;
}

from less.php.

Krinkle avatar Krinkle commented on July 17, 2024

also getting here in this

.clearfix {
  display: block;
  zoom: 1;

  &:after {
    content: " ";
    display: block;
    font-size: 0;
    height: 0;
    clear: both;
    visibility: hidden;
  }
}

this is the error I get

fatal error: ParseError: Unexpected input in anonymous-file-0.less on line 6, column 14 

I'm not able to reproduce this.

$ bin/lessc my-input.less

.clearfix {
  display: block;
  zoom: 1;
}
.clearfix:after {
  content: " ";
  display: block;
  font-size: 0;
  height: 0;
  clear: both;
  visibility: hidden;
}

Similarly, using the programmatic API:

$ php -a
php > require_once 'vendor/autoload.php';
php > $parser = new Less_Parser();
php > $parser->parse('.clearfix {  display: block;  zoom: 1;  &:after {    content: " ";    display: block;    font-size: 0;    height: 0;    clear: both;    visibility: hidden;  }} ');
php > print $parser->getCss();
.clearfix {
  display: block;
  zoom: 1;
}
.clearfix:after {
  content: " ";
  display: block;
  font-size: 0;
  height: 0;
  clear: both;
  visibility: hidden;
}

from less.php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.