pyjTransformer.js
is modified from the JSXTransformer in ReactJS.
- Auto compiles .pyj files or rapydscript code on webpage to javascript in browser.
- Run RapydScript with external framework, such as jQuery, AngularJS, ReactJS and so on.
NOTE: To run rapydscript correctly in browser with AngularJS(ensure that rapydscript compiles an executes before it), you should set attributes
async="false"
in the<script>
tag.
To run it right with ReactJS, you should also set attributes
async="false"
in the<script>
tag, and setotype="text/jsx"
.
Example:
<script type="text/pyj" otype="text/jsx" src="helloworld.pyj" async="false"></script>
Rapydscript is a pre-compiler for JavaScript, similar to CoffeeScript, but with cleaner, more readable python-like syntax.
- RapydScript on Github
- RapydScript.com
- RapydScript.cn simplified chinese docs online for RapydScript
- Yoeman angularjs generator, surpport for RapydScript, Angular and Angular-ui
- Django package for using the RapydScript javascript pre-compiler
- Language support for rapydscript (.pyj) in the Atom editor
- auto compiles rapydscript .pyj files to .js on save
pyjTransformer.js
的代码是从ReactJS中的 JSXTransformer 改的。
- 自动将浏览器中的.pyj文件或页面上的RapydScript代码编译成javascript代码。
- 可以与jQuery、AngularJS、ReactJS等外部框架共同工作。
注意: 要使RapydScript在浏览器中与AngularJS正确地工作(即保证rapydscript代码的编译和运行在AngularJS之前),你需要在
<script>
中添加属性async="false"
。
要使RapydScript与ReactJS正常工作,你需要在
<script>
中添加属性async="false"
,以及添加属性otype="text/jsx"
。
示例:
<script type="text/pyj" otype="text/jsx" src="helloworld.pyj" async="false"></script>
RapydScript是一个可以被预编译为JavaScript的脚本语言。 RapydScript与CoffeeScript很相似,但是由于它采用的是Python的语法,因而更加容易阅读。