Skip to content

Instantly share code, notes, and snippets.

@dhoko
Last active August 29, 2015 14:01
Show Gist options
  • Save dhoko/d333c6105459c59ff0d9 to your computer and use it in GitHub Desktop.
Save dhoko/d333c6105459c59ff0d9 to your computer and use it in GitHub Desktop.
Template
// Fichier dans le dossier task pour le cas deux
var gulp = require('gulp'),
concat = require("gulp-concat")
es = require('event-stream')
partials = require('gulp-partial-to-script')
streamqueue = require('streamqueue');
module.exports = function() {
"use strict";
return es.merge(
gulp.src([
'./src/layout/header.html',
'./src/layout/body.html'
]),
gulp.src('./src/partials/**/*.html').pipe(partials()),
gulp.src([
'./src/layout/footer.html',
])
)
.pipe(concat('index.html'))
.pipe(gulp.dest('./build'));
};
// Cas d'origine: ça fonctionne parfaitement
gulp.watch(["./src/layout/**/*","./src/partials/**/*"], ["templates"]);
gulp.task('templates', function() {
return es.merge(
gulp.src([
'./src/layout/header.html',
'./src/layout/body.html'
]),
gulp.src('./src/partials/**/*.html').pipe(partials()),
gulp.src([
'./src/layout/footer.html',
])
)
.pipe(concat('index.html'))
.pipe(gulp.dest('./build'))
.pipe(livereload(server));
});
// Cas deux, la task est dans un fichier
gulp.watch(["./src/layout/**/*","./src/partials/**/*"], ["templates"])
.on("change", function(file) {
livereload(server).changed(file.path);
});
gulp.task('templates', require('./tasks/template'));
@dhoko
Copy link
Author

dhoko commented May 13, 2014

Négatif mon watch est dans le gulpfile. Je laisse dans le gulpFile que le minimum à savoir, mon serveur + le watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment