Skip to content

Commit

Permalink
added ability to pass in options to msx, updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sibsibsib committed Mar 2, 2015
1 parent cfb3d12 commit ab65517
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gulp.task('lint', function () {
return gulp.src(paths.lint)
.pipe(plugins.jshint('.jshintrc'))
.pipe(plugins.plumber())
.pipe(plugins.jscs())
.pipe(plugins.jscs({}))
.pipe(plugins.jshint.reporter('jshint-stylish'));
});

Expand Down
5 changes: 3 additions & 2 deletions lib/mithrilify.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ function hasMithrilExtension(file) {
return /\.(js|msx)$/.test(file);
}

function mithrilify(file) {
function mithrilify(file, opts) {
opts = opts || {};
if (!hasMithrilExtension(file)) {
return through();
}
Expand All @@ -28,7 +29,7 @@ function mithrilify(file) {

function end() {
try {
var src = msx.transform(data);
var src = msx.transform(data, opts.msx_opts);
this.queue(src);
} catch (error) {
this.emit('error', error);
Expand Down
4 changes: 2 additions & 2 deletions test/mithrilify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('mithrilify', function () {
*/
function bundle(file, cb) {
return browserify(file, {basedir: __dirname})
.transform(mithrilify)
.transform(mithrilify, {msx_opts: {precompile:false}})
.bundle(cb);
};

Expand All @@ -40,7 +40,7 @@ describe('mithrilify', function () {
it('should compile Mithril view', function (done) {

var expectedView = 'function (ctrl) {'
+ ' return m("div", ["Hello ", ctrl.name()])'
+ ' return m("div", ["Hello ",ctrl.name()])'
+ '}';

bundle('./mock/example.js', function (err, src) {
Expand Down

0 comments on commit ab65517

Please sign in to comment.