Open nippur72 opened 8 years ago
With the latest commits:
\"
or \'
). Now there should be no more failing cases for the rt-scope
syntax (e.g. rt-scope="'x as id;' as id;"
does compile correctly).rt.valid.spec.js
into rt-html-valid.js
.This PR now implements also #135 with the new (optional) CLI option --create-element-alias
.
If an alias is specified, it will be used in place of React.createElement()
thus making shorter calls and helping the minifier.
Example of rt foo.rt --create-element-alias h
'use strict';
var h = require('react').createElement;
var _ = require('lodash');
module.exports = function () {
return h('div', {}, h('span', {}, 'Hello'));
};
This PR now fixes also an issue with -react-import-path
when the path is different from react
.
Regarding the --create-element-alias
, now is possible to have a different function name than createElement
(e.g. if using a different library than React like preact
). Just add it after a comma:
rt foo.rt --react-import-path preact --create-element-alias h,h
will generate:
var h = require('preact').h;
module.exports = function () {
return h('div', {}, h('span', {}, 'Hello'));
};
this PR now implements also #93, #183 and #184 (see for discussion).
this PR now fixes also #190
...and #191
Hi nino, Can you split this PR so we can try and merge at least some of it?
sure, I will split it into as small as possible PRs, though it might take a while since I have to do some reconciliation
This PR improves the parser for
rt-scope
as discussed in #175.It's based on a regex, the improvement comes from scanning for
as identifier;
instead of just;
thus lowering the chances of picking a semicolon in the wrong place.Of course there are still failing cases, but they are much less.
With this PR the following can be now parsed: