jstransformers / jstransformer

Normalize the API of any JSTransformer.
http://npm.im/jstransformer
MIT License
153 stars 12 forks source link

riot.js #86

Open tunnckoCore opened 8 years ago

tunnckoCore commented 8 years ago

https://github.com/riot/riot

have .compile and .render, i think both should be implemented, not sure.

tunnckoCore commented 8 years ago

just implemented https://github.com/jstransformers/jstransformer-riotjs which is based on Riot v1.0.4, last release which was "just 1kb MVP library", before become to "React-like 13kb UI lib".

v2.x.x is lil' bit hard and tricky to be implemented as transformer, i'll search for their template engine, otherwise i'll release it as separate template engine and will do other transformer for it.

aMarCruz commented 7 years ago

@tunnckoCore , depends on the desired output.

I think JSTransformer can work very nice with the riot compiler engine at riot-compiler to produce pre-compiled code for using with the riot runtime:

const riot = require('riot-compiler')

exports.name = 'riot'
exports.inputFormats = ['tag']
exports.outputFormat = 'js'

exports.render = function (src, options, url) {
  return riot.compile(src, options, url || options.filename)
}

That's all.

Note: url can be a filename, it is for sending to parsers (sort of transformers) like babel, pug, etc.

EDIT: Sorry, confuse w/ the 3rd parameters :)

tunnckoCore commented 7 years ago

@aMarCruz PRs always welcome. don't have the time.

aMarCruz commented 7 years ago

@tunnckoCore , he ...I'm busy too but the next week I will to send 2 or 3 PRs w/ transforms.