Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I build a "JavaScript Mode" version of a Processing sketch using the command line?

I'm using the "b-g" Processing build system for Sublime Text 2 (link) which works perfectly fine.

It's using the following command to initiate the build via the processing-java executable (I'm on Windows btw):

"cmd": ["processing-java", "--sketch=$file_path", "--output=$file_path/build-tmp", "--run", "--force"]

This will open the Processing application in a Java Environment.

Since I am targeting mobile devices I'd like to use JavaScript Mode though (the Processing IDE will fire up a server listening to some strange port serving a web page that you can access using any browser when exporting a sketch that way).

As I would like to avoid having to use the Processing Editor (usage of "foreign" editors has apparently been disabled in v2) I was wondering if I could trigger that behavior via my build system / the CLI?

Unfortunately I cannot find any information on that at all on the web and $ processing-java --help doesn't mention export modes as well.

like image 290
m90 Avatar asked Jan 29 '26 05:01

m90


1 Answers

No, but you can concatenate your .pde files into one source file, and then run that through the "processing-helper" for processing.js. If you clone the Processing.js repo (links on https://github.com/processing-js/processing-js) then you can load the ./tools/processing-helper.html in a browser (ideally from localhost, not file), and then just paste in your code, hit "convert", and out comes the compiled JS source.

That said, there's not all that much benefit to precompiling, since Processing.js is a browser technology. It's not "an editor", a sketch running using Processing.js is just a webpage, and all mobile devices support web pages.

like image 111
Mike 'Pomax' Kamermans Avatar answered Jan 31 '26 20:01

Mike 'Pomax' Kamermans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!