Last active
August 29, 2015 14:01
-
-
Save dhoko/d333c6105459c59ff0d9 to your computer and use it in GitHub Desktop.
Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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')); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Négatif mon watch est dans le gulpfile. Je laisse dans le gulpFile que le minimum à savoir, mon serveur + le watch.