dat.gui/gulpfile.js

92 lines
1.9 KiB
JavaScript
Raw Normal View History

2014-08-27 00:01:15 +00:00
/*
[ ] build without platform bundled
*/
var gulp = require( 'gulp' ),
2014-09-02 16:00:08 +00:00
stylus = require( 'gulp-stylus' ),
plates = require( 'gulp-plates' ),
rename = require( 'gulp-rename' ),
vulcan = require( 'gulp-vulcanize' ),
nib = require( 'nib' ),
2014-08-27 00:01:15 +00:00
fs = require( 'fs' ),
2014-09-02 16:00:08 +00:00
marked = require( 'marked' ),
karma = require( 'karma' ).server;
2014-08-27 00:01:15 +00:00
var paths = {
main: 'gui.html',
css: 'elements/**/*.styl',
html: 'elements/**/*.html',
js: 'elements/**/*.js',
2014-09-02 16:00:08 +00:00
};
2014-08-27 00:01:15 +00:00
function stylus( src, dest ) {
gulp.src( src )
2014-09-02 16:00:08 +00:00
.pipe( stylus( { use: [ nib() ] } ) )
2014-08-27 00:01:15 +00:00
.pipe( gulp.dest( dest ) );
}
2014-09-02 16:00:08 +00:00
gulp.task( 'docs', function() {
stylus( 'docs/*.styl', 'docs' );
var content = {
readme: marked( fs.readFileSync( 'README.md', 'utf8' ) )
}
gulp.src( 'docs/template.html' )
.pipe( plates( content ) )
.pipe( rename( 'index.html' ) )
.pipe( gulp.dest( './' ) );
} );
2014-08-27 00:01:15 +00:00
gulp.task( 'css', function() {
stylus( paths.css, 'elements' );
} );
gulp.task( 'vulcanize', function() {
gulp.src( paths.main )
2014-09-02 16:00:08 +00:00
.pipe( vulcan( {
2014-08-27 00:01:15 +00:00
dest: 'build',
inline: true
// strip: true
} ) );
} );
2014-09-02 16:00:08 +00:00
gulp.task( 'test', function( done ) {
2014-08-27 00:01:15 +00:00
2014-09-02 16:00:08 +00:00
karma.start( {
// browsers: [ 'Chrome' ],
frameworks: [ 'jasmine' ],
files: [
'../platform/platform.js',
'build/gui.html',
'tests/*.js'
],
// singleRun: true
}, done );
2014-08-27 00:01:15 +00:00
} );
gulp.task( 'build', [ 'css', 'vulcanize', 'test', 'docs' ] );
gulp.task( 'default', function() {
gulp.watch( [ paths.css ], [ 'css', 'vulcanize' ] );
2014-09-02 16:00:08 +00:00
gulp.watch( [ paths.js, paths.main, paths.html ], [ 'vulcanize' ] );
// gulp.watch( [ 'build/gui.html', 'tests/*.js' ], [ 'test' ] );
2014-08-27 00:01:15 +00:00
gulp.watch( [ 'README.md', 'docs/*' ], [ 'docs' ] );
} );