Less integration for pub

Less-transformer for pub-serve and pub-build.


Simply add the following lines to your pubspec.yaml:

  less_node: any
  - less_node:
  		entry_point: web/builder.less

After adding the transformer your entry_point .less file will be automatically transformed to corresponding .css file.

You need to have Less installed and available on the path, as a nodejs npm module.


You can also pass options to Lessc if necessary:

  - less_node:
      entry_point: path/to/builder.less
      output: /path/to/builded.css
      include_path: /path/to/directory/for/less/includes
      cleancss: true or false
      compress: true or false
      executable: /path/to/lessc
      build_mode: less, dart or mixed
      run_in_shell: true or false
  • entry_point - Is the ONLY option required. Normally is a builder file with "@import 'filexx.less'; ..." directives.
  • output - Is the .css file generated. If not supplied then entry_point with .css extension is used.
  • include_path - see Less Documentation include_path.
  • cleancss - see Less Documentation clean-css.
  • compress - see Less Documentation compress.
  • executable - by default 'lessc' as node npm work result
  • 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. - mixed - command 'CMD> lessc --flags input.less' with stdout managed by the dart transformer process.

  • run_in_shell - in windows lessc.cmd needs a shell, so run_in_shell default is true for this platform.