首页 > 其他 > 详细

[Maid] Write Tasks in Markdown with Maid

时间:2018-08-18 22:51:41      阅读:172      评论:0      收藏:0      [点我收藏+]

Maid enables you to write your tasks in Markdown. Create a maidfile.md or a README.mdthen add Headers to list out your tasks with codeblocks including the tasks to run. This lesson walks you through creating a few tasks in either a maidfile.md or a README.md and how to execute the tasks from the command line.

 

Install:

npm install maid --save-dev

 

Create a maidfile.md

## hello

```bash
echo "hi"
```

Then run:

npx maid hello

技术分享图片

 

-----

A more realworld example can be that we can use maid to run build process

 

Install:

npm i -D parcel

 

## build

```bash
npx parcel build index.html
```

## dev

```bash
npx parcel index.html
```

 

npx maid build

npx maid dev

 

 

----

 

We can also run another task before or after the build task:

## build

Run task `start`.

Run task `end` after.

```bash
npx parcel build index.html
```

## dev

```bash
npx parcel index.html
```

## start

```js
console.log("task start")
```

## end

```js
console.log("task end")
```

技术分享图片

 

---

 

Add description for the tasks:

## build

This build the project

Run task `start`.

Run task `end` after.

```bash
npx parcel build index.html
```

## dev

This is for development

```bash
npx parcel index.html
```

## start

This run before the build

```js
console.log("task start")
```

## end

This run after the build

```js
console.log("task end")
```

 

Run: 

npx maid help

技术分享图片

 

----

 

Using README.md:

in README file, we just need to add 

<!-- maid-tasks -->

Before the tasks we want to run, and all those tasks should have "###".

# DEMOs

    * mdx-deck
    *react-live
    *maid


## Tasks
<!-- maid-tasks -->

### build

This build the project

Run task `start`.

Run task `end` after.

```bash
npx parcel build index.html
```

### dev

This is for development

```bash
npx parcel index.html
```

### start

This run before the build

```js
console.log("task start")
```

### end

This run after the build

```js
console.log("task end")
```

 

 

Github

[Maid] Write Tasks in Markdown with Maid

原文:https://www.cnblogs.com/Answer1215/p/9498941.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!