F
F
freeman02042016-05-25 01:55:48
JavaScript
freeman0204, 2016-05-25 01:55:48

I want to glue several html files into one using gulp-include, it doesn't work. How to fix?

There is just https://www.npmjs.com/package/gulp-include and there is this https://www.npmjs.com/package/gulp-file-include and I think there is more. Not sure which one to use?
Here is my task:

gulp.task('html', function() {
   return gulp.src(['frontend/assets/index.html', 'frontend/assets/header.html'])
    .pipe(include())
    .pipe(rename('index.html'))
    .pipe(gulp.dest('public'));
});

If you need the whole code, I'll throw it off. I tried to connect 2 files that I have and glue them into index.html in the public folder. But they don't stick. If I change the index.html file, then its contents are written to the public folder, and if header.html, then the contents of header.html.
How to connect them what would be by analogy with concatCss?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danila, 2016-05-25
@freeman0204

firstly, in gulp.src it is better to specify only the main index.html file into which other pieces will be connected
; secondly, it is written in the documentation that the plugin uses a directive with which it recognizes which and where file to "send"
for HTML:
judging by the fact, that you didn’t write anything about it, I think it doesn’t exist
and then everything should work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question