From b354c820e6a45a492bcb555a4a7557b9812e3952 Mon Sep 17 00:00:00 2001 From: De Ville Weppenaar Date: Fri, 23 Oct 2015 08:51:13 +0200 Subject: [PATCH] Added Gulp and NPM to automate minify using Uglify.. --- .gitignore | 4 +++- gulpfile.js | 25 +++++++++++++++++++++++++ package.json | 10 +++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 gulpfile.js diff --git a/.gitignore b/.gitignore index 9abb766..ac11caa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.* \ No newline at end of file +node_modules/ +bower_components/ +.idea/ diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..e2acd8c --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,25 @@ +var gulp = require('gulp'); +var uglify = require('gulp-uglify'); +var del = require('del'); +var path = require('path'); +var rename = require('gulp-rename'); +var uglifySaveLicense = require('uglify-save-license'); + +gulp.task('clean', function (done) { + del([ + path.join('./', 'angular-google-gapi.min.js')], done); +}); + +gulp.task('compress', function() { + return gulp.src('angular-google-gapi.js') + .pipe(uglify({ + mangle: false, + preserveComments: uglifySaveLicense + })) + .pipe(rename({ + extname: '.min.js' + })) + .pipe(gulp.dest('./')); +}); + +gulp.task('default', ['clean', 'compress']); \ No newline at end of file diff --git a/package.json b/package.json index 30f56d3..ed65af6 100644 --- a/package.json +++ b/package.json @@ -27,4 +27,12 @@ "url": "https://github.com/maximepvrt/angular-google-gapi/issues" }, "homepage": "https://github.com/maximepvrt/angular-google-gapi" -} + "devDependencies": { + "del": "^2.0.2", + "gulp": "^3.9.0", + "gulp-rename": "^1.2.2", + "gulp-uglify": "^1.4.2", + "path": "^0.12.7", + "uglify-save-license": "^0.4.1" + } +} \ No newline at end of file