-
Notifications
You must be signed in to change notification settings - Fork 0
Commands & Extensions
Samarjeet edited this page Oct 2, 2017
·
1 revision
In addition to the primary enchant
command, stupefy has 2 more built-in commands.
1. def
This allows us to define global variables. Thus the variables can be omitted when enchanting a spell.
Syntax:
/* def global, key1: value1, key2: value2 */
Example: `/* def global, package: 'stupefy', versions: [1, 2] */
2. print
This prints the global variables into the output.
Syntax: `/* print varName */
NOTE: Comments are assumed to be / and / in this case
Custom commands can also be added. The node module name or script path is added to the plugins object in ~/.stupefy.json
to activate it. The steps involved are -
-
Create the plugin
Suppose this is stored in
~/fetch.js
module.exports = function(stupefy) {
return {
fetch: function(link, data ) {
return download(link);
}
}
}
- Registration In ~/.stupefy.json
{
"plugins": [ "/Users/[username]/fetch" ]
}
- Use it!
/* fetch https://necolas.github.io/normalize.css/7.0.0/normalize.css */
p {
content: 'I am using normalize!'
}