1.0.0 • Published 5 years ago
gulp-mammoth v1.0.0
Gulp-mammoth
Gulp plugin that converts Word documents to html or markdown files using mammoth.js
Basic usage
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
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).
1.0.0
5 years ago