Skip to content

Commit

Permalink
no need to use toString when compileClient is used
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jan 25, 2014
1 parent 9366b59 commit 59ff4c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var PluginError = require('gulp-util').PluginError;

function handleCompile(contents, opts){
if(opts.client){
return compileClient(contents, opts).toString();
return compileClient(contents, opts);
}

return compile(contents, opts)(opts.locals || opts.data);
Expand Down
5 changes: 3 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ var filename = path.join(__dirname, './fixtures/helloworld.jade');
function expectStream(t, options){
options = options || {};
var ext = options.client ? '.js' : '.html';
var compiler = options.client ? jade.compileClient : jade.compile;
return through.obj(function(file, enc, cb){
options.filename = filename;
var compiled = jade.compile(fs.readFileSync(filename), options);
var expected = options.client ? compiled.toString() : compiled(options.data);
var compiled = compiler(fs.readFileSync(filename), options);
var expected = options.client ? compiled : compiled(options.data);
t.equal(expected, String(file.contents));
t.equal(extname(file.path), ext);
if(file.relative){
Expand Down

0 comments on commit 59ff4c2

Please sign in to comment.