Created
August 1, 2014 09:58
-
-
Save icebeat/0c5d9963d8831995ab09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var Metalsmith = require('metalsmith'); | |
/* Gulp libs */ | |
var sketch = require("gulp-sketch"); | |
var clean = require('gulp-clean'); | |
var svgmin = require('gulp-svgmin'); | |
/* Custom libs */ | |
var src = require('./lib/src'); | |
var icons = require('./lib/icons'); | |
var DIST = '/Users/danielmota/GitHub/'; | |
/* Export icons */ | |
gulp.task('sketch', function(){ | |
return gulp.src('./src/*.sketch') | |
.pipe(sketch({ | |
export: 'artboards', | |
formats: 'svg' | |
})) | |
.pipe(gulp.dest('./dist/svg')); | |
}); | |
/* Optimize SVG files */ | |
gulp.task('minify', ['sketch'], function() { | |
return gulp.src('./dist/svg/*.svg') | |
.pipe(svgmin( | |
[{ | |
removeTitle: true | |
}] | |
)) | |
.pipe(gulp.dest('./dist/svg')); | |
}); | |
/* Create Sass file */ | |
gulp.task('sass', ['sketch', 'minify'], function () { | |
var metalsmith = Metalsmith(__dirname) | |
.source('dist') | |
.clean(false) | |
.use(src([ | |
'**/*.svg' | |
])) | |
.use(icons({ | |
map: 'ui-icons', | |
file: '_icons--svg.scss' | |
})) | |
.destination('dist') | |
.build(); | |
}); | |
/* Deploy files to repo */ | |
gulp.task('deploy', function() { | |
gulp.src('./dist/svg/*.svg') | |
.pipe(gulp.dest(DIST+'public/assets/svg')); | |
gulp.src('./dist/*.scss') | |
.pipe(gulp.dest(DIST+'app/styles/elements')); | |
}); | |
/* Clean Folder */ | |
gulp.task('clean', function () { | |
return gulp.src('./dist', {read: false}) | |
.pipe(clean()); | |
}); | |
gulp.task('default', ['clean', 'sketch', 'minify', 'sass']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment