From 6cf1ce7f679f7f62e2d6322a2123f5fdd9335be2 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Fri, 6 Feb 2015 16:05:06 -0600 Subject: [PATCH] Wrote copy task --- gulpfile.js | 54 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 41f5de24d7..c104cfffbd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,6 @@ var gulp = require('gulp'), es = require('event-stream'), nib = require('nib'), minifycss = require('gulp-minify-css'), - hash = require('gulp-hash'), rename = require('gulp-rename'), uglify = require('gulp-uglify'), concat = require('gulp-concat'), @@ -51,27 +50,14 @@ var paths = { cssminDest: './common/dist/sprites/' }, copy: { - src: ['./common/img/sprites/backer-only/*.gif', - './common/img/sprites/npc_ian.gif', - './bower_components/bootstrap/dist/fonts/*'], - dest: './build/' - }, - hash: { - options : { - algorithm: 'md5', - hashLength: 8, - template: '<%= name %>-<%= hash %><%= ext %>' + src: { + favicon: './website/public/favicon.ico', + sprites: './common/dist/sprites/spritesmith*.png', + backer: './common/img/sprites/backer-only/*.gif', + ian: './common/img/sprites/npc_ian.gif', + fonts: './website/public/bower_components/bootstrap/dist/fonts/*' }, - src: [ - 'website/build/*.js', - 'website/build/*.css', - 'website/public/favicon.ico', - 'common/dist/sprites/*.png', - 'common/img/sprites/backer-only/*.gif', - 'common/img/sprites/npc_ian.gif', - 'website/public/bower_components/bootstrap/dist/fonts/*' - ], - dest: 'build/*.css' + dest: './website/build/' } }; @@ -100,8 +86,30 @@ gulp.task('stylus', function() { .pipe(gulp.dest(paths.stylus.dest)); }); -gulp.task('copy', function() { - gulp.src(paths.copy.src) +gulp.task('copy', ['clean'], function() { + var getDir = function(file) { + var index = file.lastIndexOf("/"); + return file.substring(1, index); + }; + return es.merge( + gulp.src(paths.copy.src.favicon), + gulp.src(paths.copy.src.sprites) + .pipe(rename(function(path) { + path.dirname += getDir(paths.copy.src.sprites); + })), + gulp.src(paths.copy.src.backer) + .pipe(rename(function(path) { + path.dirname += getDir(paths.copy.src.backer); + })), + gulp.src(paths.copy.src.ian) + .pipe(rename(function(path) { + path.dirname += getDir(paths.copy.src.ian); + })), + gulp.src(paths.copy.src.fonts) + .pipe(rename(function(path) { + path.dirname += '/bower_components/bootstrap/dist/fonts'; + })) + ) .pipe(gulp.dest(paths.copy.dest)); });