forked from phodal/weapp-webdemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
26 lines (24 loc) · 1.08 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var gulp = require('gulp'),
exec = require('child_process').exec;
gulp.task('watch', function() {
var watcher = gulp.watch('src/**/*.wxml');
watcher.on('change', function(event) {
var outputFileName = event.path.substring(0, event.path.length - 4) + 'js';
outputFileName = outputFileName.replace('/src/', '/build/');
var inputPath = event.path.replace(__dirname + '/', '');
exec('./vendor/wcc -d ' + inputPath + ' > ' + outputFileName, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
});
});
var wxssWatcher = gulp.watch('src/**/*.wxss');
wxssWatcher.on('change', function(event) {
var outputFileName = event.path.substring(0, event.path.length - 4) + 'css';
outputFileName = outputFileName.replace('/src/', '/build/');
var inputPath = event.path.replace(__dirname + '/', '');
exec('./vendor/wcsc -d ' + inputPath + ' > ' + outputFileName, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
});
});
});