扫描HTML以获取css和js链接,并在Gulp的任务中使用它们

Okay I am just throwing this out there. I have no knowlegde of PHP and little knowlegde of Javascript.

Is it possible to check an HTML file if header css/js links and body .js links exist?

And if yes: locate them and use them in a Gulp-task in the order they are added in the HTML file?

Example header:

<head>
<meta charset="utf-8">
<title>Website | Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="The Most Awesome" content="Website">
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/barebone.css">
<link rel="stylesheet" type="text/css" href="css/custom.css"> 
</head>

Use those links in a Gulptask like:

gulp.task('css', function(){
 gulp.src("*links in html*")
.pipe(concat('main.css'))
.pipe(prefix())
.pipe(minifyCSS())
.pipe(gulp.dest('build/css'))
.pipe(connect.reload());
});

I could just declare the links in the Gulp-task but I want the Gulpfile to be as generic as possible. I want to be able to just dump my files anywhere in the folder.