B
B
buzzloud2017-07-31 17:17:07
JavaScript
buzzloud, 2017-07-31 17:17:07

Why does @@include in gulp-file-include inside the html page immediately insert the content of the include file?

Hello everyone who worked with gulp-file-include, tell me, plz)
the task looks like this:

gulp.task('fileinclude', function () {
    return gulp.src('app/.html')
        .pipe(fileinclude({
            prefix: '@@',
            basepath: '@file'
        }))
        .pipe(gulp.dest('app'));
});

gulp.task('watch', ['browser-sync', 'css-libs', 'fileinclude', 'scripts'], function () {
    gulp.watch('app/*.html', ['fileinclude']);
    gulp.watch('app/less/**/*.less', ['less']);
    gulp.watch('app/*.html', browserSync.reload);
    gulp.watch('app/js/**/*.js', browserSync.reload);
});

the crux of the matter: I add to any page, in theory, this design should remain on the current page and then be compiled into html code when building in production. The problem is that the header.html content is immediately inserted into the page - i.e. all divs, headers, links and so on. Can anyone tell me how to configure the plugin so that during development the page has @@include, and not its content?
@@include('templates/header.html')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lnked, 2017-07-31
@buzzloud

Replace .pipe(gulp.dest('app')); to .pipe(gulp.dest('dist')); - dist is the name of the folder where the compiled version will be

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question