lukeed / lukeed/taskr

task.source doesn't take effect after a yeild task

Open
#289 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.5k
Forks
72
PR merge metrics
No merged PRs in 30d

Description

I write a simple build task and a custom plugin `usemin` as following.
I thought the `files` argument of the generator function in the `usemin` plugin should be `.tmp/index.html` but, I found that I'm wrong, it contains all the files which returned by the `html` task.

so why things become so weird? (maybe I should post this question on stackoverflow. sorry ....

```js
export async function compile(task) {
await task.start('clear');
await task.parallel(['script', 'style', 'image', 'font', 'other', 'html']);
}
```
```js
export async function build(task) {
await task.start('compile');
await task.source('.tmp/index.html').usemin({
staticDir: c.build,
}).target(c.build);
}
```

```js
module.exports = function (task, utils) {
// ...
task.plugin('usemin', { every: false }, function* (files, opts) {
console.log(files.map(o=>o.dir).filter(o=>o.indexOf('.tmp')!==-1));
// [] (empty array)
});
}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the compile and build task sequence shown in the issue, especially task.start('compile') followed by task.source('.tmp/index.html'). Inspect the usemin plugin callback's files argument and compare it with the expected source; done means determining whether the retained files are intended behavior or a task-runner bug.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.