mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
7e9c39fd55
less is no longer vendored and so the previous window hack is no longer needed.
31 lines
786 B
CoffeeScript
31 lines
786 B
CoffeeScript
less = require 'less'
|
|
fs = require 'fs'
|
|
|
|
inputFile = process.argv[2]
|
|
unless inputFile?.length > 0
|
|
console.error("Input file must be first argument")
|
|
process.exit(1)
|
|
|
|
outputFile = process.argv[3]
|
|
unless outputFile?.length > 0
|
|
console.error("Output file must be second argument")
|
|
process.exit(1)
|
|
|
|
contents = fs.readFileSync(inputFile)?.toString() ? ''
|
|
|
|
parser = new less.Parser
|
|
syncImport: true
|
|
paths: [fs.realpathSync("#{__dirname}/../static"), fs.realpathSync("#{__dirname}/../vendor")]
|
|
filename: inputFile
|
|
|
|
logErrorAndExit = (e) ->
|
|
console.error("Error compiling less file '#{inputFile}':", e.message)
|
|
process.exit(1)
|
|
|
|
parser.parse contents, (e, tree) ->
|
|
logErrorAndExit(e) if e
|
|
try
|
|
fs.writeFileSync(outputFile, tree.toCSS())
|
|
catch e
|
|
logErrorAndExit(e)
|