Tyler Scott | cdfcde8 | 2015-09-14 16:13:29 -0600 | [diff] [blame] | 1 | var gulp = require('gulp'); |
Tyler Scott | e564a5a | 2015-09-16 17:43:33 -0600 | [diff] [blame^] | 2 | var minifyHTML = require('gulp-minify-html'); |
| 3 | var minifyCSS = require('gulp-minify-css'); |
| 4 | var sourcemaps = require('gulp-sourcemaps'); |
| 5 | var closure = require('gulp-closure-compiler-service'); |
| 6 | var clean = require('gulp-clean'); |
Tyler Scott | cdfcde8 | 2015-09-14 16:13:29 -0600 | [diff] [blame] | 7 | |
Tyler Scott | e564a5a | 2015-09-16 17:43:33 -0600 | [diff] [blame^] | 8 | gulp.task('minify-html', function() { |
| 9 | |
| 10 | return gulp.src(['./catalog-dev/index.html']) |
| 11 | .pipe(minifyHTML()) |
| 12 | .pipe(gulp.dest('./catalog/')); |
Tyler Scott | cdfcde8 | 2015-09-14 16:13:29 -0600 | [diff] [blame] | 13 | |
| 14 | }); |
| 15 | |
Tyler Scott | e564a5a | 2015-09-16 17:43:33 -0600 | [diff] [blame^] | 16 | gulp.task('minify-js', function() { |
| 17 | |
| 18 | return gulp.src('./catalog-dev/js/*.js') |
| 19 | .pipe(sourcemaps.init()) |
| 20 | .pipe(closure()) |
| 21 | .pipe(sourcemaps.write('../../catalog-dev/js')) |
| 22 | .pipe(gulp.dest('./catalog/js')); |
| 23 | |
| 24 | }); |
| 25 | |
| 26 | gulp.task('minify-css', function() { |
| 27 | |
| 28 | return gulp.src(['./catalog-dev/css/style.css', './catalog-dev/css/cubeLoader.css']) |
| 29 | .pipe(sourcemaps.init()) |
| 30 | .pipe(minifyCSS()) |
| 31 | .pipe(sourcemaps.write('../../catalog-dev/css')) |
| 32 | .pipe(gulp.dest('./catalog/css')); |
| 33 | |
| 34 | }); |
| 35 | |
| 36 | gulp.task('copy', function() { |
| 37 | |
| 38 | gulp.src('./catalog-dev/config.json') |
| 39 | .pipe(gulp.dest('./catalog')); |
| 40 | |
| 41 | gulp.src('./catalog-dev/css/*.min.css') |
| 42 | .pipe(gulp.dest('./catalog/css')); |
| 43 | |
| 44 | }); |
| 45 | |
| 46 | gulp.task('clean', function(){ |
| 47 | |
| 48 | return gulp.src('./catalog', {read: false}) |
| 49 | .pipe(clean()); |
| 50 | |
| 51 | }); |
| 52 | |
| 53 | gulp.task('default', ['minify-html', 'minify-css', 'minify-js', 'copy']); |
| 54 | |