question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating Custom Functions

See original GitHub issue

Hi,

It would be nice to define Custome Functions like:

  darkfadein(@color, @value) {
    return fadein(darken(@color, @value));
  }

  .foo {
    color: darkfadein(#333, 10%);
  }

should be compiled to:

  .foo {
    color: #1a1a1a;
  }

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Reactions:17
  • Comments:28 (12 by maintainers)

github_iconTop GitHub Comments

7reactions
fabienevaincommented, Jun 14, 2013

I find a hack : if you declare a global js function, you can use it later !

@fn: ~`fn = function(a) { return a; }`;

@arg: 8px;

p {
    font-size: ~`fn("@{arg}")`;
}
3reactions
rjgottencommented, Mar 25, 2019

@hiyangguo

You shouldn’t use inline JS expressions, period. Build and register custom functions the appropriate way. Read the documentation. It’s all there: http://lesscss.org/features/#plugin-atrules-feature

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create custom functions in Excel - Microsoft Support
A custom function must start with a Function statement and end with an End Function statement. In addition to the function name, the...
Read more >
How to Create a Custom Function in Excel
Click Insert Function on the Formulas tab. · In the Insert Function dialog box, select User Defined from the “select a category” dropdown...
Read more >
How To Create a Custom Function in Excel in 11 Steps - Indeed
How to create a custom function in Excel · Open VBE by pressing Alt+F11 on a PC or FN+ALT+F11 on a Mac. ·...
Read more >
How to create custom user defined functions in Excel - Ablebits
After opening VBE, you need to add a new module where you will write your functions. Right-click on the VBA project pane and...
Read more >
Custom Functions in Google Sheets | Apps Script
Getting a custom function from the Google Workspace Marketplace · Create or open a spreadsheet in Google Sheets. · At the top, click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found