Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

Commit

Permalink
Add "includePath" option to enable LESS parser to look in more places.
Browse files Browse the repository at this point in the history
Usage:

  project/
    my_less.less ('@import "import.less";)
    imports/
      import.less ('b { color: gold; ')

Then,

  recess --includePath=imports --compile my_less.less

And the import diretive in my_less.less will find import.less
automatically. Very useful when working with Bootstrap, since you can
add Bootstrap's less/ directory to `includePath` and only override the
parts you want to change (LESS still looks in the "input" directory
first).

More than one directory can be specified:

  recess --includePath=imports --includePath=exports my_less.less

Or, in `.recessrc`:

  {
    'includePath': ['imports', 'exports']
  }
  • Loading branch information
Victor Andrée committed Dec 12, 2012
1 parent 6e29eb9 commit 291657c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -19,6 +19,7 @@ OPTIONS
- --compile - compiles your code and outputs it to the terminal. Fixes white space and sort order. Can compile css or less.
- --compress - compress your compiled code.
- --config - accepts a path, which specifies a json config object
- --includePath - accepts an additional directory path to look for `@import`:ed LESS files in.
- --stripColors - removes color from output (useful when logging)
- --watch - watch filesystem for changes, useful when compiling Less projects
- --noIDs - doesn't complain about using IDs in your stylesheets
Expand Down Expand Up @@ -83,6 +84,7 @@ The following options (and defaults) are available in the programatic api:

- compile: false
- compress: false
- includePath: []
- noIDs: true
- noJSPrefix: true
- noOverqualifying: true
Expand Down
1 change: 1 addition & 0 deletions bin/recess
Expand Up @@ -18,6 +18,7 @@ options = {
compile: Boolean
, compress: Boolean
, config: path
, includePath: [path, Array]
, noIDs: Boolean
, noJSPrefix: Boolean
, noOverqualifying: Boolean
Expand Down
2 changes: 1 addition & 1 deletion lib/core.js
Expand Up @@ -67,7 +67,7 @@ RECESS.prototype = {
, parse: function () {
var that = this
, options = {
paths: [path.dirname(this.path)]
paths: [path.dirname(this.path)].concat(this.options.includePath)
, optimization: 0
, filename: this.path && this.path.replace(/.*(?=\/)\//, '')
}
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Expand Up @@ -71,6 +71,7 @@ module.exports.DEFAULTS = RECESS.DEFAULTS = {
compile: false
, compress: false
, config: false
, includePath: []
, noIDs: true
, noJSPrefix: true
, noOverqualifying: true
Expand Down

0 comments on commit 291657c

Please sign in to comment.