mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-05-05 21:54:45 +00:00
Updated gulpfile for opening browser
This commit is contained in:
parent
37ac4a68f0
commit
9e325beb98
5 changed files with 47 additions and 6 deletions
2
example/amd/js/libs/postal/postal.min.js
vendored
2
example/amd/js/libs/postal/postal.min.js
vendored
File diff suppressed because one or more lines are too long
2
example/standard/js/postal.min.js
vendored
2
example/standard/js/postal.min.js
vendored
File diff suppressed because one or more lines are too long
39
gulpfile.js
39
gulpfile.js
|
|
@ -1,12 +1,19 @@
|
|||
var gulp = require("gulp");
|
||||
var fileImports = require("gulp-imports");
|
||||
var pkg = require("./package.json");
|
||||
var header = require("gulp-header");
|
||||
var beautify = require("gulp-beautify");
|
||||
var hintNot = require("gulp-hint-not");
|
||||
var uglify = require("gulp-uglify");
|
||||
var rename = require("gulp-rename");
|
||||
var plato = require("gulp-plato");
|
||||
var rimraf = require("gulp-rimraf");
|
||||
var gutil = require("gulp-util");
|
||||
var express = require("express");
|
||||
var path = require("path");
|
||||
var tinylr = require("tiny-lr");
|
||||
var pkg = require("./package.json");
|
||||
var open = require("open");
|
||||
var port = 3080;
|
||||
|
||||
var banner = ["/**",
|
||||
" * <%= pkg.name %> - <%= pkg.description %>",
|
||||
|
|
@ -24,18 +31,44 @@ gulp.task("combine", function() {
|
|||
.pipe(hintNot())
|
||||
.pipe(beautify({indentSize: 4}))
|
||||
.pipe(gulp.dest("./lib/"))
|
||||
.pipe(gulp.dest("./example/amd/js/libs/postal"))
|
||||
.pipe(gulp.dest("./example/standard/js"))
|
||||
.pipe(uglify({ compress: { negate_iife: false }}))
|
||||
.pipe(header(banner, { pkg : pkg }))
|
||||
.pipe(rename("postal.min.js"))
|
||||
.pipe(gulp.dest("./lib/"));
|
||||
.pipe(gulp.dest("./lib/"))
|
||||
.pipe(gulp.dest("./example/amd/js/libs/postal"))
|
||||
.pipe(gulp.dest("./example/standard/js"));
|
||||
});
|
||||
|
||||
gulp.task("default", function() {
|
||||
gulp.run("combine");
|
||||
gulp.run("report");
|
||||
});
|
||||
|
||||
gulp.task("report", function () {
|
||||
gulp.src("./lib/postal.js")
|
||||
.pipe(plato("report"));
|
||||
});
|
||||
|
||||
var createServer = function(port) {
|
||||
var p = path.resolve("./");
|
||||
var app = express();
|
||||
app.use(express.static(p));
|
||||
app.listen(port, function() {
|
||||
gutil.log("Listening on", port);
|
||||
});
|
||||
|
||||
return {
|
||||
app: app
|
||||
};
|
||||
};
|
||||
|
||||
var servers;
|
||||
|
||||
gulp.task("server", function(){
|
||||
gulp.run("report");
|
||||
if(!servers) {
|
||||
servers = createServer(port);
|
||||
}
|
||||
open( "http://localhost:" + port + "/index.html" );
|
||||
});
|
||||
|
|
@ -53,6 +53,9 @@
|
|||
<div class="well well-large">
|
||||
<a href="spec/">Tests</a>
|
||||
</div>
|
||||
<div class="well well-large">
|
||||
<a href="report/">Plato Reports</a>
|
||||
</div>
|
||||
<div class="well well-large">
|
||||
<a href="example/amd">AMD Example Usage</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -86,7 +86,12 @@
|
|||
"gulp-hint-not": "~0.0.3",
|
||||
"gulp-uglify": "~0.1.0",
|
||||
"gulp-rename": "~0.2.1",
|
||||
"gulp-plato": "~0.1.0"
|
||||
"gulp-plato": "~0.1.0",
|
||||
"gulp-beautify": "~1.0.3",
|
||||
"tiny-lr": "0.0.5",
|
||||
"express": "~3.4.7",
|
||||
"gulp-rimraf": "0.0.8",
|
||||
"open": "~0.0.4"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue