gulp-livescript
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,9 @@ | ||
## 2.1.0 (2014-11-06) | ||
#### Features | ||
* **index.js:** add support for .json.ls extension ([043d92da](https://github.com/tomchentw/gulp-livescript/commit/043d92da728fa90adb29909557db3c4cd69802a8)) | ||
## 2.0.0 (2014-10-17) | ||
@@ -2,0 +10,0 @@ |
@@ -1,4 +0,5 @@ | ||
var through2, LiveScript, gutil; | ||
var through2, LiveScript, path, gutil; | ||
through2 = require('through2'); | ||
LiveScript = require('LiveScript'); | ||
path = require('path'); | ||
gutil = require('gulp-util'); | ||
@@ -8,3 +9,3 @@ module.exports = function(options){ | ||
function modifyLS(file, enc, done){ | ||
var error, fileExtension, input, t, json; | ||
var error, input, dirname, filename, json, t; | ||
if (file.isNull()) { | ||
@@ -17,4 +18,12 @@ return done(null, file); | ||
try { | ||
fileExtension = ".js"; | ||
input = file.contents.toString("utf8"); | ||
dirname = path.dirname(file.path); | ||
filename = path.basename(file.path, '.ls'); | ||
if (path.extname(filename) === '.json' || options.json) { | ||
file.path = path.join(dirname, path.basename(file.path, '.json') + '.json'); | ||
json = true; | ||
} else { | ||
file.path = path.join(dirname, filename + '.js'); | ||
json = false; | ||
} | ||
t = { | ||
@@ -24,3 +33,2 @@ input: input, | ||
}; | ||
json = options.json; | ||
t.tokens = LiveScript.tokens(t.input, { | ||
@@ -37,7 +45,5 @@ raw: options.lex | ||
t.result = LiveScript.run(t.output, options, true); | ||
t.output = JSON.stringify(t.result, null, 2) + "\n"; | ||
fileExtension = ".json"; | ||
t.output = JSON.stringify(t.result, null, 2) + '\n'; | ||
} | ||
file.contents = new Buffer(t.output); | ||
file.path = gutil.replaceExtension(file.path, fileExtension); | ||
} catch (e$) { | ||
@@ -44,0 +50,0 @@ error = e$; |
{ | ||
"name": "gulp-livescript", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Compile LiveScript to JavaScript for Gulp", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
13131
54