UNPKG

2.2 kBMarkdownView Raw
1# majo
2
3<a href="https://www.pixiv.net/member_illust.php?mode=medium&illust_id=62542828">
4<img src="https://ooo.0o0.ooo/2017/04/27/59016709425c9.jpg" width="300" />
5</a>
6
7*Art by [でんでんCOMIC1・こ24b](https://www.pixiv.net/member.php?id=12192)*
8
9[![NPM version](https://img.shields.io/npm/v/majo.svg?style=flat)](https://npmjs.com/package/majo) [![NPM downloads](https://img.shields.io/npm/dm/majo.svg?style=flat)](https://npmjs.com/package/majo) [![CircleCI](https://circleci.com/gh/egoist/majo/tree/master.svg?style=shield&circle-token=560404744e167900959a512d617a05ec5240616f)](https://circleci.com/gh/egoist/majo/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate)
10
11## Introduction
12
13You can use *majo* to manipulate files like a pro, with a simple API whose core is only ≈ 150 SLOC.
14
15## Install
16
17```bash
18yarn add majo
19```
20
21## Usage
22
23```js
24const majo = require('majo')
25
26const stream = majo()
27
28// Given that you have js/app.js js/index.js
29stream
30 .source('js/**')
31 .use(ignoreSomeFiles)
32 .dest('dist')
33 .then(() => {
34 // Now you got filtered files
35 })
36
37function ignoreSomeFiles(stream) {
38 for (const filename in stream.files) {
39 const content = stream.fileContents(filename)
40 // Remove it if content has specific string
41 if (/some-string/.test(content)) {
42 delete stream.files[filename]
43 }
44 }
45}
46```
47
48## Support
49
50[API docs](/docs/api.md)<br>
51[Middleware](/docs/middleware.md)
52
53## Used By
54
55- [SAO](https://github.com/egoist/sao): ⚔️ Futuristic scaffolding tool.
56
57## Contributing
58
591. Fork it!
602. Create your feature branch: `git checkout -b my-new-feature`
613. Commit your changes: `git commit -am 'Add some feature'`
624. Push to the branch: `git push origin my-new-feature`
635. Submit a pull request :D
64
65
66## Author
67
68**majo** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License.<br>
69Authored and maintained by egoist with help from contributors ([list](https://github.com/egoist/majo/contributors)).
70
71> [egoist.moe](https://egoist.moe) · GitHub [@egoist](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)