gulp-spa
gulp-spa copied to clipboard
specify concat filename in build block
First off I haven't tried your module yet but it's looks great! Coming from gulp-usemin, is it possible to specify the concat filename in the buildblock?
<!-- build:css build/app.css -->
<link rel="stylesheet" href="foo.css">
<link rel="stylesheet" href="bar.css">
<!-- endbuild -->
Thanks!
there is no build in concatenation in gulp-spa, use gulp-concat to do that, that way you can also define the new file name.
Is there a way to do that without changing the gulp build script every time there is a change to the list of stylesheets or scripts? I really don't want to some of my web programmers modifying the build script.
you can specify the input files in your html file.
<html>
<head>
<link rel="stylesheet" href="used-to-be-stylus-1.css">
<link rel="stylesheet" href="used-to-be-stylus-2.css">
</head>
<body>
<script src="used-to-be-coffee-script-1.js"></script>
<script src="used-to-be-coffee-script-2.js"></script>
</body>
</html>
you also could just load all (e.g.) JS files in one directory:
<html>
<body>
<!-- build:js -->
<!-- endbuild -->
</body>
</html>
gulp.task("build", function () {
return gulp.src("./path/to/index.html")
.pipe(spa.html({
pipelines: {
js: function () {
return gulp.src("./path/to/javascripts/*.js")
.pipe(concat("app.js"));
}
}
})))
.pipe(gulp.dest("./public/"));
});
(examples from the README file...)
What I'm looking for is a way to specify the output in the html file. A static output file won't work when I different dependencies on for a bunch html files. In the concat example I would need a new build function for every differing html file and it would become a nightmare to manage.
Thanks!