File: less-css-mode.el.html

This mode provides syntax highlighting for Less CSS files
(https://lesscss.org/), plus optional support for compilation of
.less files to .css files at the time they are saved: use
less-css-compile-at-save to enable this.

Command line utility "lessc" is required if setting less-css-compile-at-save to t. To install "lessc" using the Node.js package manager, run "npm install less".

Also make sure the "lessc" executable is in Emacs's PATH, example:
(push (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)
or customize less-css-lessc-command to point to your "lessc" executable.

We target lessc >= 1.4.0, and thus use the --no-color flag by default. You may want to adjust less-css-lessc-options for compatibility with older versions.

less-css-mode is derived from css-mode, and indentation of nested blocks may not work correctly with versions of css-mode other than that bundled with recent Emacs.

You can specify per-file values for less-css-compile-at-save, less-css-output-file-name or less-css-output-directory using a variables header at the top of your .less file, e.g.:

// -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*-

Alternatively, you can use directory local variables to set the default value of less-css-output-directory for your project.

In the case of files which are included in other .less files, you may want to trigger the compilation of a "master" .less file on save: you can accomplish this with less-css-input-file-name, which is probably best set using directory local variables.

If you don't need CSS output but would like to be warned of any syntax errors in your .less source, consider using flymake-less: https://github.com/purcell/flymake-less.

; Credits

The original code for this mode was, in large part, written using Anton Johansson's scss-mode as a template -- thanks Anton! https://github.com/antonj

Defined variables (10)

less-css-compile-at-saveIf non-nil, Less buffers are compiled to CSS after each save.
less-css-input-file-nameFile name which will be compiled to CSS.
less-css-lessc-commandCommand used to compile Less files.
less-css-lessc-optionsCommand line options for Less executable.
less-css-mode-abbrev-tableAbbrev table for ‘less-css-mode’.
less-css-mode-hookHook run after entering ‘less-css-mode’.
less-css-mode-mapKeymap for ‘less-css-mode’.
less-css-mode-syntax-tableSyntax table for ‘less-css-mode’.
less-css-output-directoryDirectory in which to save CSS, or nil to use the Less file’s directory.
less-css-output-file-nameFile name in which to save CSS, or nil to use <name>.css for <name>.less.

Defined functions (4)

less-css--output-path()
less-css-compile()
less-css-compile-maybe()
less-css-mode()

Defined faces (0)