[Maid] Write Tasks in Markdown with Maid

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Maid] Write Tasks in Markdown with Maid相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/headers' title='headers'>headers   man   html   width   div   list   pre   develop   wal   

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

鎶€鏈垎浜浘鐗? src=

 

-----

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")
```

鎶€鏈垎浜浘鐗? src=

 

---

 

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

鎶€鏈垎浜浘鐗? src=

 

----

 

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的主要内容,如果未能解决你的问题,请参考以下文章

洛谷P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper

洛谷 P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper

Threading and Tasks in Chrome

P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper [模拟退火]

P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper

P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper