mit
mithrilify
npm i mithrilify
mit

mithrilify

Browserify transform for converting Mithril view templates based on msx

by Jens Krause

0.0.6 (see all)License:MITTypeScript:Not Found
npm i mithrilify
Readme

mithrilify

Browserify transform for converting Mithril view templates using MSX

NPM version Build Status Dependency Status

Install

$ npm install --save-dev mithrilify

Usage

Example of a Mithril view template.

It can be defined within a *.js or *.msx file and should include /** @jsx m */ at the top.

'use strict';

var View = function (ctrl) {
  return <div>
      hello
    </div>;
};

module.exports = View;

Command line:

$ browserify -t mithrilify ./view.js > ./bundle.js

Gulp and gulp-browserify

var gulp = require('gulp');
  browserify = require('gulp-browserify'),
  rename = require('gulp-rename');

gulp.task('bundle', function() {
  gulp.src('app/scripts/view.js')
    .pipe(browserify({
      transform: ['mithrilify']
    }))
    .pipe(rename('bundle.js'))
    .pipe(gulp.dest('build/'))
});

Grunt and grunt-browserify


browserify: {
  dist: {
    files: {
      'build/bundle.js': 'app/scripts/view.js',
    },
    options: {
      transform: ['mithrilify']
    }
  }
}

Output:

'use strict';

var View = function (ctrl) {
  return {tag: "div", attrs: {}, children: [
      "hello"
    ]};
};
module.exports = View;

Test

Clone project:

$ git clone https://github.com/sectore/mithrilify.git && cd $_

Install dependencies (only once):

$ npm install

Run tests:

$ gulp test

Credits:

  • MSX for supporting JSX to Mithril
  • generator-node-gulp to create a Node.js module with yo, including gulp and Mocha unit tests.

Contributors

Release History

History

License

Copyright (c) 2015 Jens Krause. Licensed under the MIT license.

Downloads/wk

218

GitHub Stars

38

LAST COMMIT

7yrs ago

MAINTAINERS

1

CONTRIBUTORS

5

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
0.0.6
latest
7yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate