diff options
author | Joe George <joe@zeroc.com> | 2015-02-18 15:43:52 -0500 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2015-02-18 15:43:52 -0500 |
commit | e1f8da73ec82a44bd23f6dfe430a3ed23b8c3e7c (patch) | |
tree | 75be9d70a067f0898abea22684e9eb41b2f6a297 /js/gulp/commonTasks.js | |
parent | Undo bogus change where EventLoggerMsg.h/.rc was added to the git repo. (diff) | |
download | ice-e1f8da73ec82a44bd23f6dfe430a3ed23b8c3e7c.tar.bz2 ice-e1f8da73ec82a44bd23f6dfe430a3ed23b8c3e7c.tar.xz ice-e1f8da73ec82a44bd23f6dfe430a3ed23b8c3e7c.zip |
ICE-6301 - Align nodejs source and npm distributions
Diffstat (limited to 'js/gulp/commonTasks.js')
-rw-r--r-- | js/gulp/commonTasks.js | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/js/gulp/commonTasks.js b/js/gulp/commonTasks.js new file mode 100644 index 00000000000..a0219c1390e --- /dev/null +++ b/js/gulp/commonTasks.js @@ -0,0 +1,117 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +var browserSync = require("browser-sync"); +var concat = require('gulp-concat'); +var del = require("del"); +var gzip = require('gulp-gzip'); +var minifycss = require('gulp-minify-css'); +var newer = require('gulp-newer'); +var path = require('path'); +var uglify = require("gulp-uglify"); + +var util = require('./util'); + +module.exports = function(gulp) { + var common = + { + "scripts": [ + "bower_components/foundation/js/vendor/modernizr.js", + "bower_components/foundation/js/vendor/jquery.js", + "bower_components/foundation/js/foundation.min.js", + "bower_components/nouislider/distribute/jquery.nouislider.all.js", + "bower_components/animo.js/animo.js", + "bower_components/spin.js/spin.js", + "bower_components/spin.js/jquery.spin.js", + "bower_components/highlightjs/highlight.pack.js", + "assets/icejs.js"], + "styles": + ["bower_components/foundation/css/foundation.css", + "bower_components/animo.js/animate+animo.css", + "bower_components/highlightjs/styles/vs.css", + "bower_components/nouislider/distribute/jquery.nouislider.min.css", + "assets/icejs.css"] + }; + + gulp.task("common:slice", [], + function() + { + return gulp.src(["test/Common/Controller.ice"]) + .pipe(util.slice2js({dest: "test/Common"})) + .pipe(gulp.dest("test/Common")); + }); + + gulp.task("common:slice:clean", [], + function() + { + del(["test/Common/Controller.js"]); + }); + + gulp.task("common:slice:watch", ["common:slice"], + function() + { + gulp.watch(["test/Common/Controller.ice"], function(){ + gulp.start("common:slice", function(){ + browserSync.reload("test/Common/Controller.js"); + }); + }); + }); + + gulp.task("common:js", ["bower"], + function() + { + return gulp.src(common.scripts) + .pipe(newer("assets/common.min.js")) + .pipe(concat("common.min.js")) + .pipe(uglify()) + .pipe(gulp.dest("assets")) + .pipe(gzip()) + .pipe(gulp.dest("assets")); + }); + + gulp.task("common:js:watch", ["common:js"], + function() + { + gulp.watch(common.scripts, + function(){ + gulp.start("common:js", function(){ + browserSync.reload("assets/common.min.js"); + }); + }); + }); + + gulp.task("common:css", ["bower"], + function() + { + return gulp.src(common.styles) + .pipe(newer("assets/common.css")) + .pipe(concat("common.css")) + .pipe(minifycss()) + .pipe(gulp.dest("assets")) + .pipe(gzip()) + .pipe(gulp.dest("assets")); + }); + + gulp.task("common:css:watch", ["common:css"], + function() + { + gulp.watch(common.styles, + function(){ + gulp.start("common:css", function(){ + browserSync.reload("assets/common.css"); + }); + }); + }); + + gulp.task("common:clean", [], + function() + { + del(["assets/common.css", "assets/common.min.js"]); + }); +}; |