-
Notifications
You must be signed in to change notification settings - Fork 2
JavaScript API
Wilson FT edited this page Jun 20, 2017
·
21 revisions
kebot API
var kebot = require("kebot");
kebot.task({
alias:"css",
entry:"./task-css.js"
});Type: Object
Type: String
alias Name of the task to use by the CLI.
Type: String
alias The path of your node script.
Type: String
command Run any installed CLI
Type: Array
sequential When you have option.entry task dependencies, are executed sequentially and at the end the main task is executed.
When you not have option.entry they are only tasks that are executed sequentially.
Type: Array
parallel Tasks that run in sequence without dependency.
type: Boolean
local In true : Run a CLI from a locally installed package, just like npm scripts when to use command input. Default false
// task-css.js
var fs = require('fs');
var postcss = require('postcss');
var autoprefixer = require('autoprefixer');
fs.readFile('src/index.css', function(err, css){
postcss([autoprefixer])
.process(css, { from: 'src/index.css', to: 'public/index.css' })
.then(function(result){
fs.writeFile('public/index.css', result.css);
if(result.map){
fs.writeFile('public/index.css.map', result.map);
};
});
});// kebotfile.js
var kebot = require("kebot");
kebot.task({
alias:"css",
entry:"./task-css.js"
});Then run and see the magic
kb css