Created
November 7, 2014 22:07
-
-
Save diverted247/62c3c8327724f6aabb89 to your computer and use it in GitHub Desktop.
Gulpfile to start a local server and open browser on mac/win/linux
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'); | |
var ts = require( 'gulp-tsc' ); | |
var connect = require( 'gulp-connect' ); | |
var shell = require( 'gulp-shell' ); | |
// 1541 - Claude Garamond was commissioned to create fonts for King Francis I | |
// of France and established himself as the first type designer. | |
gulp.task( 'build' , function(){ | |
return gulp.src( [ './src/txt/build.d.ts' ] ) | |
.pipe( ts( { | |
target: 'ES5', | |
out: 'txt.js', | |
outDir: './dist', | |
emitError: true, | |
declaration: true, | |
removeComments: true | |
} ) ) | |
.pipe( gulp.dest( './dist' ) ); | |
}); | |
gulp.task( 'server' , [ 'build' ] , function () { | |
connect.server({ | |
port: 1541, | |
livereload: false | |
}) | |
}); | |
gulp.task( 'browser' , [ 'server' ] , shell.task( [ | |
/^win/.test( require( 'os' ).platform() ) ? 'start http://localhost:1541/' : 'open http://localhost:1541/' | |
] ) ); | |
gulp.task( 'default' , [ 'browser' ] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment