diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2014-09-16 21:41:49 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2014-09-16 21:41:49 +1200 |
commit | bfef9b494098b9948fe5b0d2f757513d4289ec1b (patch) | |
tree | 2d40a8b2c20f4a5da006df9262f7d448ea0cee31 /web | |
parent | e4ee3e0236069873332fff13baefe4f676e289ee (diff) | |
download | mitmproxy-bfef9b494098b9948fe5b0d2f757513d4289ec1b.tar.gz mitmproxy-bfef9b494098b9948fe5b0d2f757513d4289ec1b.tar.bz2 mitmproxy-bfef9b494098b9948fe5b0d2f757513d4289ec1b.zip |
Slightly more verbose gulping, remove strict declarations for now.
Diffstat (limited to 'web')
-rw-r--r-- | web/gulpfile.js | 67 | ||||
-rw-r--r-- | web/src/js/stores/base.js | 1 | ||||
-rw-r--r-- | web/src/js/stores/eventlogstore.js | 1 | ||||
-rw-r--r-- | web/src/js/stores/settingstore.js | 1 |
4 files changed, 46 insertions, 24 deletions
diff --git a/web/gulpfile.js b/web/gulpfile.js index 50c1a3fa..4130012f 100644 --- a/web/gulpfile.js +++ b/web/gulpfile.js @@ -53,67 +53,92 @@ var path = { fonts: ["src/vendor/fontawesome/fontawesome-webfont.*"], html: ["src/*.html", "!src/benchmark.html", "!src/test.html"] }; + + gulp.task("fonts", function () { return gulp.src(path.fonts) .pipe(gulp.dest(path.dist + "static/fonts")); }); -function styles(files, dev) { + +function styles_dev(files) { + return (gulp.src(files, {base: "src", cwd: "src"}) + .pipe(dont_break_on_errors()) + .pipe(sourcemaps.init()) + .pipe(less()) + .pipe(sourcemaps.write(".", {sourceRoot: "/static"})) + .pipe(gulp.dest(path.dist + "static")) + .pipe(livereload({ auto: false }))); +} +gulp.task("styles-app-dev", styles_dev.bind(undefined, path.css.app)); +gulp.task("styles-vendor-dev", styles_dev.bind(undefined, path.css.vendor)); +gulp.task("styles-dev", ["styles-app-dev", "styles-vendor-dev"]); + + +function styles_prod(files) { return (gulp.src(files, {base: "src", cwd: "src"}) - .pipe(dev ? dont_break_on_errors() : gutil.noop()) - .pipe(dev ? sourcemaps.init() : gutil.noop()) .pipe(less()) - .pipe(dev ? sourcemaps.write(".", {sourceRoot: "/static"}) : gutil.noop()) // No sourcemaps support yet :-/ // https://github.com/jonathanepollack/gulp-minify-css/issues/34 - .pipe(!dev ? minifyCSS() : gutil.noop()) + .pipe(minifyCSS()) .pipe(gulp.dest(path.dist + "static")) .pipe(livereload({ auto: false }))); } -gulp.task("styles-app-dev", styles.bind(undefined, path.css.app, true)); -gulp.task("styles-app-prod", styles.bind(undefined, path.css.app, false)); -gulp.task("styles-vendor-dev", styles.bind(undefined, path.css.vendor, true)); -gulp.task("styles-vendor-prod", styles.bind(undefined, path.css.vendor, false)); -gulp.task("styles-dev", ["styles-app-dev", "styles-vendor-dev"]); +gulp.task("styles-app-prod", styles_prod.bind(undefined, path.css.app)); +gulp.task("styles-vendor-prod", styles_prod.bind(undefined, path.css.vendor)); gulp.task("styles-prod", ["styles-app-prod", "styles-vendor-prod"]); -function scripts(files, filename, dev) { + +function scripts_dev(files, filename) { return gulp.src(files, {base: "src", cwd: "src"}) - .pipe(dev ? dont_break_on_errors(): gutil.noop()) - .pipe(dev ? sourcemaps.init() : gutil.noop()) - .pipe(react({harmony: false})) + .pipe(dont_break_on_errors()) + .pipe(sourcemaps.init()) + .pipe(react()) .pipe(concat(filename)) - .pipe(!dev ? uglify() : gutil.noop()) - .pipe(dev ? sourcemaps.write(".", {sourceRoot: "/static"}) : gutil.noop()) + .pipe(sourcemaps.write(".", {sourceRoot: "/static"})) .pipe(gulp.dest(path.dist + "static/js")) .pipe(livereload({ auto: false })); } -gulp.task("scripts-app-dev", scripts.bind(undefined, path.js.app, "app.js", true)); -gulp.task("scripts-app-prod", scripts.bind(undefined, path.js.app, "app.js", false)); -gulp.task("scripts-vendor-dev", scripts.bind(undefined, path.js.vendor, "vendor.js", true)); -gulp.task("scripts-vendor-prod", scripts.bind(undefined, path.js.vendor, "vendor.js", false)); +gulp.task("scripts-app-dev", scripts_dev.bind(undefined, path.js.app, "app.js")); +gulp.task("scripts-vendor-dev", scripts_dev.bind(undefined, path.js.vendor, "vendor.js")); gulp.task("scripts-dev", ["scripts-app-dev", "scripts-vendor-dev"]); + + +function scripts_prod(files, filename) { + return gulp.src(files, {base: "src", cwd: "src"}) + .pipe(react()) + .pipe(concat(filename)) + .pipe(uglify()) + .pipe(gulp.dest(path.dist + "static/js")) + .pipe(livereload({ auto: false })); +} +gulp.task("scripts-app-prod", scripts_prod.bind(undefined, path.js.app, "app.js")); +gulp.task("scripts-vendor-prod", scripts_prod.bind(undefined, path.js.vendor, "vendor.js")); gulp.task("scripts-prod", ["scripts-app-prod", "scripts-vendor-prod"]); + gulp.task("jshint", function () { return gulp.src(["src/js/**"]) .pipe(dont_break_on_errors()) - .pipe(react({harmony: false /* Do not do Harmony transformation for JSHint */})) + .pipe(react()) .pipe(jshint()) .pipe(jshint.reporter("jshint-stylish")) }); + gulp.task("html", function () { return gulp.src(path.html) .pipe(gulp.dest(path.dist + "templates")) .pipe(livereload({ auto: false })); }); + gulp.task('test', function() { return gulp.src('src/test.html') .pipe(qunit({verbose: true})); }); + common = ["fonts", "html", "jshint"]; gulp.task("dev", common.concat(["styles-dev", "scripts-dev"])); gulp.task("prod", common.concat(["styles-prod", "scripts-prod"])); diff --git a/web/src/js/stores/base.js b/web/src/js/stores/base.js index c02c77b6..e72141b5 100644 --- a/web/src/js/stores/base.js +++ b/web/src/js/stores/base.js @@ -1,4 +1,3 @@ -"use strict"; function EventEmitter() { this.listeners = {}; diff --git a/web/src/js/stores/eventlogstore.js b/web/src/js/stores/eventlogstore.js index dbecc749..23f8d3ed 100644 --- a/web/src/js/stores/eventlogstore.js +++ b/web/src/js/stores/eventlogstore.js @@ -1,4 +1,3 @@ -"use strict"; // // We have an EventLogView and an EventLogStore: // The basic architecture is that one can request views on the event log diff --git a/web/src/js/stores/settingstore.js b/web/src/js/stores/settingstore.js index 9139076e..23ac6dca 100644 --- a/web/src/js/stores/settingstore.js +++ b/web/src/js/stores/settingstore.js @@ -1,4 +1,3 @@ -"use strict"; function _SettingsStore() { EventEmitter.call(this); |