mafintosh / mafintosh/parallel-transform
Question: How do I use this to parallelize execution?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 80
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
So I use `gulp-html-minifier-terser` on 875 html files which takes 4 minutes on my 24 core machine and uses one core I think.
I would hope to use your tool to get that down to much less. 10s maybe?
I'm not experienced with gulp but the task looks like this:
```
const htmlmin = require("gulp-html-minifier-terser");
gulp.task("minify", () => {
return gulp
.src("_site/**/*.html")
.pipe(
htmlmin({
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: true,
})
)
.pipe(gulp.dest("_site"));
});
```
and applying parallel-transform I get to instantiate `htmlmin` but not to actually apply it to the files. What is missing here:
```
const htmlmin = require('gulp-html-minifier-terser');
const transform = require('parallel-transform');
gulp.task("minify", () => {
return gulp
.src("_site/**/*.html")
.pipe(
transform(24, {ordered:false}, (file, callback) => {
htmlmin({
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: true,
})
callback(null, file)
})
)
.pipe(gulp.dest("_site"));
});
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the gulp task and the parallel-transform callback shown in the issue, then read the gulp-html-minifier-terser and parallel-transform entry points to understand how files are transformed. Reproduce the 875-file task and determine what usage or library change is needed for minification to run in parallel; done means the documented task applies minification and the output remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100