Questions tagged [less]

Less is an open-source stylesheet preprocessor that extends CSS with dynamic behavior such as variables, mixins, operations and functions. For the UNIX command, use [less-unix].

Less is an open-source stylesheet preprocessor that extends with dynamic behavior such as variables, mixins, operations and functions. It was developed by Alexis Sellier, more commonly known as cloudhead and is now hosted on GitHub.

Less is written in JavaScript and can be run both on the client-side and the server-side (with Node.js, Rhino, etc.). The code compiles the Less syntax into CSS and thus what is ultimately rendered by the browser is CSS, not Less. The syntax itself is similar to CSS and you can use it seamlessly along with regular CSS. The file extension of Less files is .less.

External Links:

Online Less Compilers: (Recommended by the official Less website)

Online Demo Environments:

The following websites (also recommended by the official Less website) can be used to create a live demo of the problem area and can be linked in the question to further illustrate complex problems.


The name less is also the name of a unix command which displays a file. For questions on that topic, use .

7295 questions
58
votes
8 answers

less.js not working in chrome

I noticed that less.js is working in firefox but not in Chrome, or is it because I made an error? @highlight:…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
57
votes
4 answers

Loop through array of variable names in Less

In our app, we have a preset list of colors that a user can be choose from and everything related to that user will have that color. Throughout the app, we will have various modules with the color attached as a class name. eg.
Jason Varga
  • 1,949
  • 2
  • 21
  • 29
56
votes
2 answers

How can I use the path from gulp.src() in gulp.dest()?

Trying to create a gulp task that will pipe a bunch of files from different folders through LESS and then output them to a folder based on the original source. Consider this folder structure: Project +-- /Module_A | +- /less | | +- a.less | …
Adam
  • 738
  • 1
  • 5
  • 11
53
votes
2 answers

Is it possible to inline LESS stylesheets?

For example, is it possible to do something like:
David Wolever
  • 148,955
  • 89
  • 346
  • 502
53
votes
14 answers

How do I compile a directory full of less css files to css?

I have a directory full of less css files. What is the best way to compile them to normal css? (for deployment) Id like to run a command as follows: lessc -r less/ css/ where lessc is the less compiler (installed via node package manager)
tallowen
  • 4,198
  • 7
  • 27
  • 35
52
votes
10 answers

MVC4 Less Bundle @import Directory

I'm trying to use MVC4 bundling to group some of my less files, but it looks like the import path I'm using is off. My directory structure is: static/ less/ mixins.less admin/ user.less In user.less, I'm attempting…
JesseBuesking
  • 6,496
  • 4
  • 44
  • 89
52
votes
2 answers

How do you add syntax highlighting for Less in Notepad++?

I want Notepad++ to treat my .less files just as my .css files and thereby get syntax highlighting for any .less files I open.
Mattias Alfborger
  • 848
  • 1
  • 7
  • 15
51
votes
10 answers

Variable Name Error "is undefined" even though "variables.less" imported

I started using LESS today. But it's kinda weird. This code does not work. I get an error: ! Variable Name Error: @linkColor in a is undefined. My bootstrap: @import "variables.less"; @import "normalize.less"; variables.less: @linkColor: …
conradkleinespel
  • 6,560
  • 10
  • 51
  • 87
50
votes
9 answers

Compass style libraries for LESS css?

SASS has Compass (a community maintained library of sass mixins/methods). Does LESS have any supporting libraries that can compare to Compass? Listing anything would be helpful!
tester
  • 22,441
  • 25
  • 88
  • 128
50
votes
1 answer

All bootstrap breakpoints deprecated?

Looking at variables.less (and from googling around), it looks like all of bootstrap's breakpoint less variables are deprecated. Is this correct? Does anybody know what we should be using instead if we want to assign styles based on bootstrap's…
launchoverit
  • 4,807
  • 4
  • 20
  • 23
49
votes
4 answers

Reference a class/mixin without completely importing the LESS file

I'm using the roots theme for wordpress: https://github.com/retlehs/roots/ It already comes with a precompiled bootstrap.css and recommends to use app.css for any customizations. As I don't have the options to add the classes to the buttons via html…
FLX
  • 4,634
  • 14
  • 47
  • 60
48
votes
5 answers

LESS file does not load (404)

I'm using IIS 7.5 and I'm unable to load the less file because it gives a 404 error. HTML: Less Tutorial
Diogo Cardoso
  • 21,637
  • 26
  • 100
  • 138
48
votes
4 answers

How to generate CSS with loop in less

I am not familiar with Less. In my understanding, I think Less can transform the less format file to standard css file(if I am wrong, please correct me). Now I have a question below. Say you would generate 100 CSS classes like below(from .span1 to…
Joe.wang
  • 11,537
  • 25
  • 103
  • 180
48
votes
8 answers

LESS CSS set variables in media query?

I'm working on a iPad-specific website. To make my website work on both the retina display iPad and older versions of iPads, I want to set a variable in LESS CSS in media query like: @media all and (max-width: 768px) { @ratio: 1; } @media all…
Sean
  • 567
  • 1
  • 5
  • 8
47
votes
5 answers

Defining Variable Variables using LESS CSS

Say I have three separate color schemes that are used on various pages in a site. Each color has a a light, medium and dark tint defined, and the color scheme is defined by a class in the body. Assume that the "red" color scheme is the default. Like…
Kerri
  • 1,211
  • 2
  • 15
  • 22