gulp-rapyd ? looking for rapyd.compile

55 views
Skip to first unread message

Vince Zd

unread,
Nov 7, 2014, 7:02:29 AM11/7/14
to rapyd...@googlegroups.com
Hi all,
I can at last try out RapydScript in my project :) So I'd like to integrate it with my gulp workflow(1).
I didn't find an existed plugin so I looked at the gulp-coffee plugin to see how it's done.
https://github.com/wearefractal/gulp-coffee/blob/master/index.js
  It's a node program, so they first require coffee-script:

var coffee = require('coffee-script');

and then compile the sources with a call to coffee.compile:

      data = coffee.compile(str, options);

I fired a node console, imported rapydscript, and… didn't find a "compile" equivalent.

So how shall I do that ? Is there an equivalent of "compile" ?
Does anyone has integrated rapyd to his gulp/grunt/... workflow ? (how do you compile the sources and watch for changes, only from the command line ?)


Thanks !

Vincent

(1) gulp: https://github.com/gulpjs/gulp

Vince Zd

unread,
Nov 7, 2014, 8:43:01 AM11/7/14
to rapyd...@googlegroups.com
I had not tried rapydscript.minify, given the name, but it actually looks like the way to go !
I'll keep you updated if I come with something usable.
I'm still interested in knowing how you integrate the compilation process into your workflow though.

++

Alexander Tsepkov

unread,
Nov 7, 2014, 8:49:46 AM11/7/14
to Vince Zd, RapydScript
RapydScript compiler structure is very similar to that of UglifyJS (the core is based on it), so you can probably get it working by looking at UglifyJS integration examples rather than coffee, that should also explain the choice of 'minify' as a name, which I should probably rename to compile. There are a couple projects by other members that already hook into RapydScript to do something similar:


As far as the RapydScript compiler itself, I use RapydScript's 'parse' method to generate the AST, and then AST.print to dump it to JavaScript - ends up doing the same thing but gives me a bit more control.

Vince Zd

unread,
Nov 7, 2014, 10:11:53 AM11/7/14
to rapyd...@googlegroups.com, vin...@gmail.com
Thanks, that's very helpful.

I suggest you put the links in evidence in the Readme. They are really useful but they were hard to find, and they show that RapydScript is already integrated into popular tools.

Vince Zd

unread,
Nov 19, 2014, 7:07:19 AM11/19/14
to rapyd...@googlegroups.com, vin...@gmail.com
 Hi,
Here is my take at it: https://gitlab.com/vindarel/gulp-rapyd
Please note that the basic use case is working fine but, as indicated in the readme, I didn't test the options yet (but I already need to do it for my pet project) and I didn't adapt the tests.

Regards

Alexander Tsepkov

unread,
Nov 19, 2014, 10:39:29 AM11/19/14
to Vince Zd, RapydScript
Great job vince, I'll also add compile alias for minify this weekend or document that option in the README so there is no confusion in the future.
Reply all
Reply to author
Forward
0 new messages