Skip to content

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

Open
@stkevintan

Description

@stkevintan

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 ....

export async function compile(task) {
  await task.start('clear');
  await task.parallel(['script', 'style', 'image', 'font', 'other', 'html']);
}
export async function build(task) {
  await task.start('compile');
  await task.source('.tmp/index.html').usemin({
    staticDir: c.build,
  }).target(c.build);
}
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)
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions