How to export from sweet.js?

147 views Asked by At

I want to create a new macro command in JS for my project and I heard about sweet.js. After I was reading about that a little bit I found this page that explain how to export your commands, but I didn't really understand the Github system and I always see commands with syntax like that: $ sjs --module ./macros.js my_sweet_code.js and I can't figure out where I'm supposed to run those commands. So if someone can explain how to use this library and how to run github commands in general I will be glad.

P.S: I saw sweet.js is a mozilla library, it means that it works only on FF? Ff yes, is there any solution for all the browsers?

1

There are 1 answers

0
timdisney On BEST ANSWER

The line sjs --module ./macros.js my_sweet_code.js needs to be run on the command line on a system that has node.js and sweet.js installed. You can install node from here and once that's installed you can use the npm command on the command line to installed sweet.js: npm install -g sweet.js. With sweet.js installed you can then use the sjs command to compile code.

Also, sweet.js is a Mozilla project it but works everywhere.