Skip to content

Commit

Permalink
v2.4.1. Improvement.
Browse files Browse the repository at this point in the history
- v2.4.1 January 28, 2014
	- We now default `referencesOthers` to true if the less file imports other files
  • Loading branch information
balupton committed Jan 28, 2014
1 parent 541a8f6 commit cf6083c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
17 changes: 8 additions & 9 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# History

- v2.4.0 January 3, 2013
- Dependency upgrades
- `less` from ~1.5.1 to ~1.6.0
- v2.4.1 January 28, 2014
- We now default `referencesOthers` to true if the less file imports other files

- v2.4.0 January 3, 2014
- Updated dependencies

- v2.3.1 December 31, 2013
- Removed support for `cssmin` plugin, cssmin plugin now works differently
Expand All @@ -12,17 +14,14 @@
- Added support for `cssmin` plugin
- Thanks to [Rob Loach](https://github.com/RobLoach) for [pull request #6](https://github.com/docpad/docpad-plugin-less/pull/6)
- Repackaged
- Dependency upgrades
- `less` from ~1.4.2 to ~1.5.1
- Updated dependencies

- v2.2.0 July 28, 2013
- Dependency upgrades
- Updated dependencies

- v2.1.3 March 7, 2013
- Repackaged
- Dependency upgrades
- `less` from 1.3.x to ~1.3.0
- `coffee-script` from 1.4.x to ~1.4.0
- Updated dependencies

- v2.1.2 December 5, 2012
- Better error reporting
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docpad-plugin-less",
"version": "2.4.0",
"version": "2.4.1",
"description": "Adds support for the LESS CSS pre-processor to DocPad",
"homepage": "http://docpad.org/plugin/less",
"license": {
Expand Down Expand Up @@ -53,7 +53,7 @@
},
"devDependencies": {
"docpad": "6",
"coffee-script": "~1.6.2",
"coffee-script": "~1.7.0",
"projectz": "~0.3.9"
},
"main": "./out/less.plugin.js",
Expand Down
15 changes: 8 additions & 7 deletions src/less.plugin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,31 @@ module.exports = (BasePlugin) ->
# Render some content
render: (opts,next) ->
# Prepare
config = @config
{inExtension,outExtension,templateData,file} = opts
config = @getConfig()
{inExtension,outExtension,file} = opts

# Check extensions
if inExtension is 'less' and outExtension in ['css',null]
# Requires
path = require('path')
less = require('less')

# Prepare
srcPath = file.get('fullPath')
dirPath = path.dirname(srcPath)
parseOptions =
paths: [dirPath]
paths: [file.get('fullDirPath')]
filename: file.get('fullPath')

# Extend Parser Options
parseOptions[key] = value for own key,value of config.parseOptions if config.parseOptions

# Add Reference Others if this document does
# As lesscss concats imports
file.setMetaDefaults('referencesOthers': true) if opts.content.indexOf('@import') isnt -1

# Parse
new (less.Parser)(parseOptions).parse opts.content, (err,tree) ->
# Check
if err
err = new Error(less.formatError(err,parseOptions))
err = new Error(less.formatError(err, parseOptions))
return next(err)

# Prepare
Expand Down

0 comments on commit cf6083c

Please sign in to comment.