less-tree

command module
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 19 Imported by: 0

README

less-tree

GoDoc go report card

A tool to batch your server-side LESS compilations.

less-tree runs lessc on many LESS files at once, increasing the throughput and decreasing the amount of time it takes to do a full compile of all your LESS files.

less-tree assumes your public folder looks like this:

public/
|-- css/
|-- less/
   |-- sub-dir/
      |-- style-sub.less
   |-- _include.less
   |-- style-1.less
   |-- style-2.less

And all you have to do is run:

less-tree public

This will compile every *.less file in the the less subdirectory of public, and put the resulting stylesheets in the css subdirectory, keeping the directory structures intact. Your public directory will now look like this:

public/
|-- css/
   |-- sub-dir/
      |-- style-sub.css
   |-- style-1.css
   |-- style-2.css
|-- less/
   |-- sub-dir/
      |-- style-sub.less
   |-- _include.less
   |-- style-1.less
   |-- style-2.less

Other features:

  • Includes: less-tree treats any file or directory prefixed with a _ as a non-output LESS file, meaning it assumes it's only used as an include and won't run lessc on those files independently.
  • Minification: less-tree can optionally minify your CSS as well, using cssmin. The minified versions will be stored parallel to the non-minified versions. Simply pass -min -cssmin-path="/path/to/cssmin".
  • Intelligent caching: by default, less-tree will only compile LESS files with changes or LESS files with imports that have changed (you can force a recompile of everything using -f). less-tree keeps track of what's changed in a JSON file in <public_dir>/css/.less-tree-cache. There is probably not much inherently risky in keeping it accessible, but if you want to block access to it, an .htaccess in <public_dir>/css with the following should do the trick:
<Files ".less-tree-cache">
  Order Allow,Deny
  Deny from all
</Files>

Requirements

less-tree doesn't compile anything on its own (yet), so you'll need to be able to install a couple of npm nodules

  • lessc installed as a command-line program via npm. You can get more details here, or you can just run npm install -g less.
  • cssmin (optional) is required if you want to minify your outputted CSS, you can install it via npm install -g cssmin.

Help

Type less-tree -help to see a full command reference.

License

less-tree is released under the MIT license.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL