aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
committerKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
commite573b3020c032400eed60b649a2cbf55266e6bb0 (patch)
tree8f572394ac8433529c7a8e70d160a2fbe8268b4e /vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee
parentb8c667bd64b3edd38d56c63c5bd1db53a23b4499 (diff)
downloadmyconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.gz
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.bz2
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.zip
Add current configurations from old repository
Diffstat (limited to 'vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee')
-rw-r--r--vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee41
1 files changed, 41 insertions, 0 deletions
diff --git a/vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee b/vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee
new file mode 100644
index 0000000..0b05e4a
--- /dev/null
+++ b/vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee
@@ -0,0 +1,41 @@
+#!/usr/bin/env node
+
+fs = require 'fs'
+less = require 'less'
+args = process.argv.slice(1)
+options = {}
+
+args = args.filter (arg) ->
+ match = arg.match(/^-I(.+)$/)
+ if match
+ options.paths.push(match[1]);
+ return false
+
+ match = arg.match(/^--?([a-z][\-0-9a-z]*)(?:=([^\s]+))?$/i)
+ if match
+ arg = match[1]
+ else
+ return arg
+
+ switch arg
+ when 'strict-imports' then options.strictImports = true
+ when 'include-path'
+ options.paths = match[2].split(if os.type().match(/Windows/) then ';' else ':')
+ .map (p) ->
+ if p
+ return path.resolve(process.cwd(), p)
+ when 'O0' then options.optimization = 0
+ when 'O1' then options.optimization = 1
+ when 'O2' then options.optimization = 2
+
+options.filename = args[1]
+
+parser = new(less.Parser) options
+
+fs.readFile(options.filename, 'utf-8', (err,data) ->
+ parser.parse(data, (err, tree) ->
+ if err
+ less.writeError err
+ process.exit(1)
+ )
+)