I know this may be a fringe case, but I'd love to get this working.

This module is throwing the following error:

LESS error: parse error: failed at `@props: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;` line: 791, sites/all/themes/cores/assets/less/global/style.less

Here is the line that is throwing the error:

@props: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;

The full write up can be found here for what I'm doing: http://www.toekneestuck.com/blog/2012/05/15/less-css-arguments-variable

Any ideas how I can get this working with the LESS drupal module?

Comments

corey.aufang’s picture

Component: Code » Documentation
Category: bug » support

Keep in mind that this module uses thelessphp implementation, which tries to stick close to the lesscss.org but doesn't match 100%.

The particular operation you are trying to accomplish is specific to lesscss.org implementation as it evaluates javascript calls.

If you give me a specific example of what you're trying to accomplish, I might be able to direct you on how to accomplish it with lessphp's compliant syntax.

interestingaftermath’s picture

Thanks for replying so quickly. Somehow, I missed this so I am just now replying...

What I am trying to do is detailed here: http://toekneestuck.com/blog/2012/05/15/less-css-arguments-variable/

.box-shadow(@shadowA, @shadowB:X, ...){
  @props: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
  -webkit-box-shadow: @props;
     -moz-box-shadow: @props;
          box-shadow: @props;
}
corey.aufang’s picture

You could do something similar to a solution I posted in an older issue, #1405704-3: Using @arguments.

Try something like this:

.box-shadow(@props){
  -webkit-box-shadow: e(@props);
     -moz-box-shadow: e(@props);
          box-shadow: e(@props);
}

@color: rgba(0,0,0,0.5);
.box-shadow("1px 1px 2px @{color}, transparent 0 0 0");
interestingaftermath’s picture

Thanks! This works.

Is there anyway to get it to work without the quotes?

.box-shadow(0 0 4px rgba(0,0,0,0.30))

corey.aufang’s picture

Sadly, I don't think so. :/

corey.aufang’s picture

Category: support » task
Status: Active » Needs work

I'm going to go ahead and mark for documentation so I remember to get to this.

interestingaftermath’s picture

Thanks, Corey

corey.aufang’s picture

Title: This module doesn't play nice with regex » Less implementations in PHP don't support embedded JavaScript
Issue summary: View changes
corey.aufang’s picture

Version: 7.x-2.6 » 7.x-4.x-dev
Status: Needs work » Fixed

  • corey.aufang committed a7838db on
    Issue #1796758 by corey.aufang: Less implementations in PHP don't...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.