You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.5 KiB

  1. # grunt-contrib-less [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-less.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-less)
  2. > Compile LESS files to CSS.
  3. ## Getting Started
  4. This plugin requires Grunt `~0.4.0`
  5. If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
  6. ```shell
  7. npm install grunt-contrib-less --save-dev
  8. ```
  9. Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
  10. ```js
  11. grunt.loadNpmTasks('grunt-contrib-less');
  12. ```
  13. *This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-less/tree/grunt-0.3-stable).*
  14. ## Less task
  15. _Run this task with the `grunt less` command._
  16. Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
  17. ### Options
  18. #### paths
  19. Type: `String|Array`
  20. Default: Directory of input file.
  21. Specifies directories to scan for @import directives when parsing. Default value is the directory of the source, which is probably what you want.
  22. #### compress
  23. Type: `Boolean`
  24. Default: False
  25. Compress output by removing some whitespaces.
  26. #### yuicompress
  27. Type: `Boolean`
  28. Default: False
  29. Compress output using cssmin.js
  30. #### optimization
  31. Type: `Integer`
  32. Default: null
  33. Set the parser's optimization level. The lower the number, the less nodes it will create in the tree. This could matter for debugging, or if you want to access the individual nodes in the tree.
  34. #### strictImports
  35. Type: `Boolean`
  36. Default: False
  37. Force evaluation of imports.
  38. #### dumpLineNumbers
  39. Type: `String`
  40. Default: false
  41. Configures -sass-debug-info support.
  42. Accepts following values: `comments`, `mediaquery`, `all`.
  43. ### Usage Examples
  44. ```js
  45. less: {
  46. development: {
  47. options: {
  48. paths: ["assets/css"]
  49. },
  50. files: {
  51. "path/to/result.css": "path/to/source.less"
  52. }
  53. },
  54. production: {
  55. options: {
  56. paths: ["assets/css"],
  57. yuicompress: true
  58. },
  59. files: {
  60. "path/to/result.css": "path/to/source.less"
  61. }
  62. }
  63. }
  64. ```
  65. ## Release History
  66. * 2013-04-24   v0.5.1   Gracefully handle configuration without sources
  67. * 2013-02-14   v0.5.0   First official release for Grunt 0.4.0.
  68. * 2013-01-22   v0.5.0rc7   Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. Remove experimental wildcard destination support. Switching to this.files api.
  69. * 2012-10-17   v0.3.2   Add support for dumpLineNumbers.
  70. * 2012-10-11   v0.3.1   Rename grunt-contrib-lib dep to grunt-lib-contrib.
  71. * 2012-09-23   v0.3.0   Global options depreciated Revert normalize linefeeds.
  72. * 2012-09-15   v0.2.2   Support all less options Normalize linefeeds Default path to dirname of src file.
  73. * 2012-09-09   v0.2.0   Refactored from grunt-contrib into individual repo.
  74. ---
  75. Task submitted by [Tyler Kellen](http://goingslowly.com/)
  76. *This file was generated on Thu Apr 25 2013 09:47:05.*