How to compile several RapydScript files into one Javascript file?

103 views
Skip to first unread message

Bakalov Daniil

unread,
Apr 15, 2017, 2:00:12 AM4/15/17
to RapydScript
Hello! RapydScript is one of my favorite technologies and I will promote it widely among the developers.

Soon I will make a presentation on the topic of pythonization startups and how to apply along with RapydScript + web.py

Despite the fact that I actively enough use RS I still have questions. Maybe I'm not very attentive to documentation...

At the moment I conveniently broke RS the files in your project, but sometimes I need to work with functions from other files. Is ideal for this purpose would have been to compile all my .pyj files into one .js

How to achieve this?

Alexander Tsepkov

unread,
Apr 15, 2017, 2:05:09 AM4/15/17
to Bakalov Daniil, RapydScript
It works exactly the same way as in Python. You include an import statement at the top. Depending on exact import syntax, RapydScript compiler will create proper namespace, pull in the relevant code (unless it has already been pulled in earlier - so it will handle duplicate imports efficiently), and create local aliases if needed:

     from module import Foo, Bar

In fact, if you look at the compiler files themselves, compiler imports all of its modules into a single rapydscript.js file, and you can see how it does so by looking at individual files:


Glad you're enjoying the language.
Reply all
Reply to author
Forward
0 new messages