From 632f161c80d0dff722da7c5a460c08d90282e89d Mon Sep 17 00:00:00 2001 From: George Michael Brower Date: Tue, 2 Sep 2014 20:14:37 -0400 Subject: [PATCH] gulpfile --- gulpfile.js | 66 ++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index a162943..14ebb4a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,25 +11,30 @@ var gulp = require( 'gulp' ), marked = require( 'marked' ), karma = require( 'karma' ); +gulp.task( 'default', [ 'build' ], function() { + + karma.server.start( { + frameworks: [ 'jasmine' ], + files: [ + 'build/gui.js', + 'tests/*.js' + ] + } ); -function css( src, dest ) { - - return gulp.src( src ) - .pipe( stylus( { use: [ nib() ] } ) ) - .pipe( gulp.dest( dest ) ); - -} - -gulp.task( 'clean', function() { - - return gulp.src( [ 'build/*', '**/*.css' ] ) - .pipe( clean() ); + gulp.watch( [ 'elements/**/*.styl', 'elements/**/*.html', 'elements/**/*.js', 'gui.html' ], [ 'build' ] ); + gulp.watch( [ 'README.md', 'docs/*' ], [ 'docs' ] ); } ); -gulp.task( 'css', function() { +gulp.task( 'build', [ 'vulcanize' ], function() { - return css( 'elements/*/*.styl', 'elements' ); + return gulp.src( 'build/gui.html' ) + .pipe( replace( /\\/g, "\\\\" ) ) + .pipe( replace( /'/g, "\\'" ) ) + .pipe( replace( /^(.*)$/gm, "'$1'," ) ) + .pipe( insert.wrap( 'document.write([', '].join("\\n"))' ) ) + .pipe( rename( 'gui.js' ) ) + .pipe( gulp.dest( 'build' ) ); } ); @@ -44,15 +49,9 @@ gulp.task( 'vulcanize', [ 'css' ], function() { } ); -gulp.task( 'build', [ 'vulcanize' ], function() { +gulp.task( 'css', function() { - return gulp.src( 'build/gui.html' ) - .pipe( replace( /\\/g, "\\\\" ) ) - .pipe( replace( /'/g, "\\'" ) ) - .pipe( replace( /^(.*)$/gm, "'$1'," ) ) - .pipe( insert.wrap( 'document.write([', '].join("\\n"))' ) ) - .pipe( rename( 'gui.js' ) ) - .pipe( gulp.dest( 'build' ) ); + return css( 'elements/*/*.styl', 'elements' ); } ); @@ -71,18 +70,17 @@ gulp.task( 'docs', function() { } ); +gulp.task( 'clean', function() { -gulp.task( 'default', [ 'build' ], function() { - - karma.server.start( { - frameworks: [ 'jasmine' ], - files: [ - 'build/gui.js', - 'tests/*.js' - ] - } ); + return gulp.src( [ 'build/*', '**/*.css' ] ) + .pipe( clean() ); - gulp.watch( [ 'elements/**/*.styl', 'elements/**/*.html', 'elements/**/*.js' ], [ 'build' ] ); - gulp.watch( [ 'README.md', 'docs/*' ], [ 'docs' ] ); +} ); -} ); \ No newline at end of file +function css( src, dest ) { + + return gulp.src( src ) + .pipe( stylus( { use: [ nib() ] } ) ) + .pipe( gulp.dest( dest ) ); + +} \ No newline at end of file