Created
May 22, 2014 07:45
-
-
Save mikaa123/0a30004d12af4df66eb5 to your computer and use it in GitHub Desktop.
Gulp xsl reload
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
var gulp = require('gulp'), | |
gutil = require('gulp-util'), | |
spawn = require('child_process').spawn, | |
livereload = require('gulp-livereload') | |
replace = require('gulp-replace'); | |
gulp.task('staticsvr', function(next) { | |
var staticS = require('node-static'), | |
server = new staticS.Server('./'), | |
port = 2888; | |
require('http').createServer(function (request, response) { | |
request.addListener('end', function () { | |
server.serve(request, response); | |
}).resume(); | |
}).listen(port, function() { | |
gutil.log('Server listening on port: ' + gutil.colors.magenta(port)); | |
next(); | |
}); | |
}); | |
gulp.task('watch', ['staticsvr'], function() { | |
var server = livereload(); | |
gulp.watch(['*.js', '*.css', '*.xml', '*.xsl']).on('change', function(file) { | |
var child = spawn("xslty", ["input.xml adminViewSupervisorTracking.xsl > result.html"], {cwd: process.cwd()}); | |
child.on('close', function () { | |
gutil.log('done transforming xml'); | |
server.changed(file.path); | |
}); | |
}); | |
}); | |
gulp.task('build', function(){ | |
gulp.src(['adminViewSupervisorTracking.xsl']) | |
.pipe(replace(/http\:\/\/192.168.10.57:8080/g, '')) | |
.pipe(gulp.dest('build')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment