Created
March 5, 2014 00:11
-
-
Save mindblender/9358562 to your computer and use it in GitHub Desktop.
This file contains hidden or 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'), | |
| exec = require('gulp-exec'), | |
| less = require('gulp-less'), | |
| path = require('path'), | |
| map = require('vinyl-map'), | |
| cat = require('gulp-cat'), | |
| fs = require('fs'); | |
| var settings = { | |
| skin: null, | |
| src: './*.less', | |
| dest: null | |
| }; | |
| gulp.task('init', function() { | |
| var populate = map(function(code, filename) { | |
| settings.dest = code.toString().match(/server\.home=.*/g)[0].split('=')[1]; | |
| var xml2js = require('xml2js'); | |
| var parser = new xml2js.Parser(); | |
| var xml = fs.readFileSync('../../../../data/required_entities/stylesheet-descriptor/Respondr.stylesheet-descriptor.xml'); | |
| parser.parseString(xml, function(err,result){ | |
| settings.skin = result['stylesheet-descriptor']['stylesheet-parameter'][0]['default-value'][0]; | |
| }); | |
| }); | |
| var stream = gulp.src('../../../../../../../build.properties') | |
| .pipe(populate); | |
| return stream; | |
| }); | |
| gulp.task('less', ['init'], function () { | |
| gulp.src('./*.less') | |
| .pipe(less({ | |
| settings: [ | |
| './' | |
| ] | |
| }).on('error', gutil.log)) | |
| .pipe(gulp.dest(settings.dest)); | |
| }); | |
| gulp.task('watch', ['init'] ,function() { | |
| gulp.watch('./**/*.less', ['less']); | |
| }); | |
| gulp.task('default', ['init','less', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment