Skip to content

JavaScript API

Wilson FT edited this page Jun 20, 2017 · 21 revisions

kebot API

kebot.task(options)

var kebot = require("kebot");

kebot.task({
  alias:"css",
  entry:"./task-css.js"
});

options

Type: Object

options.alias

Type: String

alias Name of the task to use by the CLI.

options.entry

Type: String

alias The path of your node script.

options.command

Type: String

command Run any installed CLI

options.sequential

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.

options.parallel

Type: Array

parallel Tasks that run in sequence without dependency.

options.local

type: Boolean local In true : Run a CLI from a locally installed package, just like npm scripts when to use command input. Default false

Example
// 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

Clone this wiki locally