gulp-spa icon indicating copy to clipboard operation
gulp-spa copied to clipboard

specify concat filename in build block

Open jamesj2 opened this issue 10 years ago • 4 comments

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!

jamesj2 avatar Sep 18 '14 19:09 jamesj2

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.

chpio avatar Oct 17 '14 13:10 chpio

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.

jamesj2 avatar Oct 20 '14 19:10 jamesj2

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

chpio avatar Oct 22 '14 09:10 chpio

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!

jamesj2 avatar Oct 23 '14 13:10 jamesj2