Less integration for pub
CMD> pub run lessc
args file.less file.css
A working example: CMD> pub run lessc test/less/charsets.less
And a error example: CMD> pub run lessc --no-color test/less/errors/import-subfolder1.less
pub-build and pub-serve usage
Simply add the following lines to your
dependencies: less_dart: any transformers: - less_dart: entry_point: web/builder.less
After adding the transformer your entry_point
.less file will be automatically transformed to
You can also pass options to Lessc if necessary:
transformers: - less_dart: entry_points: - path/to/builder.less - or/other.less output: /path/to/builded.css include_path: /path/to/directory/for/less/includes cleancss: true or false compress: true or false build_mode: less, dart or mixed other_flags: - to include in the lessc command line
- entry_point - Is the ONLY option required. Normally is a builder file with "@import 'filexx.less'; ..." directives.
- entry_points - Alternative to entry_point. Let process several .less input files.
output - Only works with one entry_point file. Is the .css file generated.
If not supplied (or several entry_points) then input .less with .css extension changed is used.
- include_path - see Less Documentation include_path.
- cleancss - see Less Documentation clean-css.
- compress - see Less Documentation compress.
build_mode - - less - command 'CMD> lessc --flags input.less > output.css' is used. - dart - command 'CMD> lessc --flags -' with stdin and stdout piped in the dart transformer process. See build folder. - mixed - command 'CMD> lessc --flags input.less' with stdout managed by the dart transformer process. See build folder.
- other_flags - Let add other flags such as (-line-numbers=comments, ...) in the lessc command line.
How to use in other programs
- import 'package:less_dart/less.dart';
- create the Less class: Less less = new Less();
- call transform future.
See a example in: test/simply_test.dart
- Sources from lessc 1.7.5.
- Pass the standard tests in windows (no tested in linux).
- cleanCSS not implemented yet.
- source-map not implemented yet.
- error color output. Implemented, but not tested in linux. In windows cmd don't work.
Added option --banner=bannerfile.txt. Could change in next versions according to official version.
Copyright (c) 2009-2015 Alexis Sellier & The Core Less Team.
Copyright (c) 2014-2014 Adalberto Lacruz for dart translation.
Licensed under the Apache License.