Skip to content

Commit

Permalink
updated README and package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
lgcavalheiro committed Dec 5, 2020
1 parent 9ee1e2a commit 8738c87
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,48 @@

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![Build Status](https://travis-ci.org/lgcavalheiro/gulp-mammoth.svg?branch=main)](https://travis-ci.org/lgcavalheiro/gulp-mammoth) [![Coverage Status](https://coveralls.io/repos/github/lgcavalheiro/gulp-mammoth/badge.svg?branch=main&service=github)](https://coveralls.io/github/lgcavalheiro/gulp-mammoth?branch=main)

## Gulp plugin that converts Word documents to html or markdown files using [mammoth.js](https://github.com/mwilliamson/mammoth.js)
### Gulp plugin that converts Word documents to html or markdown files using [mammoth.js](https://github.com/mwilliamson/mammoth.js)

---

## Project still under construction, more TBD
## Basic usage

```javascript
const gulp = require("gulp");
const series = gulp.series;

const mammoth = require("../src/index");

function basicUsage() {
return gulp.src("./data/nonEmpty.docx").pipe(mammoth("html")).pipe(gulp.dest("./results"));
}

module.exports.default = series(basicUsage);
```

## Usage example with gulp-if

```javascript
const gulp = require("gulp");
const gulpIf = require("gulp-if");
const series = gulp.series;

const mammoth = require("../src/index");

function withGulpIf() {
return gulp
.src("./data/*")
.pipe(gulpIf(file => file.basename.toLowerCase().includes("html"), mammoth("html")))
.pipe(gulpIf(file => file.basename.toLowerCase().includes("markdown"), mammoth("md")))
.pipe(gulpIf(file => file.basename.toLowerCase().includes("text"), mammoth("txt")))
.pipe(gulp.dest("./results"));
}

module.exports.default = series(withGulpIf);
```

All usage examples can be found on `example` folder and can be executed with `yarn gulp --gulpfile ./example/name_of_file.gulpfile.js`

## Running tests

You can use `yarn test` to run the test suite once, or you can run `yarn gulp` inside the root of the project to activate continuous TDD (it will run the tests every time a file is updated).
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "gulp-mammoth",
"version": "0.1.0",
"version": "1.0.0",
"description": "Gulp plugin that uses mammoth.js to convert word documents to html or markdown.",
"main": "src/index.js",
"scripts": {
"test": "nyc mocha test/unit/*.test.js",
"tdd": "gulp",
"coveralls": "nyc report --reporter=text-lcov | coveralls"
},
"keywords": [
Expand Down

0 comments on commit 8738c87

Please sign in to comment.