NAME

CSS::LESS - Compile LESS stylesheet files (.less) using lessc

SYNOPSIS

use CSS::LESS;
# Compile a single LESS stylesheet
my $less = CSS::LESS->new();
my $css = $less->compile('a:link { color: lighten('#000000', 10%); }');
print $css."\n";

# Compile a LESS stylesheets with using @include syntax of LESS.
$less = CSS::LESS->new( include_paths => ['/foo/include/'] );
$css = $less->compile('@import (less) 'bar.less'; div { width: 100px; }');
print $css."\n";

This module has just launched development yet. Your feedback is very appreciated.

REQUIREMENTS

lessc

It must installed, because this module is wrapper of "lessc".

You can install "lessc" using "npm" (Node.js Package Manager).

$ npm install -g less
$ lessc -v
lessc x.x.x (LESS Compiler) [JavaScript]

INSTALLATION (from GitHub) $ git clone git://github.com/mugifly/p5-CSS-LESS.git $ cpanm ./p5-CSS-LESS

METHODS

new ( [%params] )

Create an instance of CSS::LESS.

%params :

include_paths

Path of include .less files.

This paths will be used for the @include syntax of .less stylesheet.

Use case of example:

# File-A of LESS stylesheet
# This file will be set as content when calling a 'compile' method.
@include (less) 'foo.less';
~~~~

# File-B of LESS stylesheet
# This file was already saved to: /var/www/include/foo.less
div {
  width: (100+200)px;
}
~~~~

# Example of script
my less = CSS::LESS->new( include_paths => [ '/var/www/include/' ] )
my $css = $less->compile( File-A ); # Let compile the File-A.
print $css."\n"; # It includes the File-B, and will be compiled.

Note: This module has released as alpha version.

lessc_path

Path of LESS compiler (default: 'lessc' on the PATH.)

dry_run

Dry-run mode for debug. (default: 0)

dont_die

When an errors accrued, don't die. (default: 0)

tmp_path

Path of save for temporally files. (default: '/tmp/'' or other temporally directory.)

compile ( $content )

Parse a LESS (.less) stylesheet, and compile to CSS (.css) stylesheet.

If you would prefer to compile from a file, firstly, please read a file with using the "File::Slurp" module or open method as simply. Then, parse it with this 'compile' method.

is_lessc_installed ( )

Check for lessc has installed.

last_error ()

Get a message of last error. (This method is useful only if 'dont_die' option is set when initialized an instance.)

SEE ALSO

https://github.com/mugifly/p5-CSS-LESS - Your feedback is highly appreciated.

CSS::Sass

COPYRIGHT AND LICENSE

Copyright (C) 2013, Masanori Ohgita (http://ohgita.info/).

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.