Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to LESS 2.4.0 #15

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.1",
"version": "2.5.0",
"description": "Adds support for the LESS CSS pre-processor to DocPad",
"homepage": "http://docpad.org/plugin/less",
"license": {
Expand Down Expand Up @@ -48,7 +48,7 @@
"node": ">=0.4"
},
"dependencies": {
"less": "~1.6.0"
"less": "~2.4.0"
},
"peerDependencies": {
"docpad": "6"
Expand Down
15 changes: 2 additions & 13 deletions src/less.plugin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,10 @@ module.exports = (BasePlugin) ->
file.setMetaDefaults('referencesOthers': true) if opts.content.indexOf('@import') isnt -1

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already gives us an err. No reason to build another one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this makes the error a lot more readable, such as including the line numbers of input source and sometimes a code sample


# Prepare
compileOptions =
compress: config.compress

# Extend Compile Options
compileOptions[key] = value for own key,value of config.compileOptions if config.compileOptions

# Compile
opts.content = tree.toCSS(compileOptions)
opts.content = output.css

# Done
return next()
Expand Down
6 changes: 6 additions & 0 deletions test/out-expected/include.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body strong {
font-weight: bold;
}
body h1 {
background-color: red;
}
7 changes: 7 additions & 0 deletions test/src/documents/include.css.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import "less.css.less";

body {
h1 {
background-color: red;
}
}