diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..081f93e --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,48 @@ +/** + * Gulpfile for File Icon Vectors + * + * @author Daniel M. Hendricks + * @license MIT + * {@link https://github.com/dmhendricks/file-icon-vectors GitHub repo} + */ + +var pkg = require( './package.json' ); +var gulp = require( 'gulp' ); +var rename = require( 'gulp-rename' ); +var minifycss = require( 'gulp-uglifycss' ); +var svgmin = require( 'gulp-svgmin' ); +var sass = require( 'gulp-sass' ); +var autoprefixer = require( 'gulp-autoprefixer' ); +var lineec = require( 'gulp-line-ending-corrector' ); +var filter = require( 'gulp-filter' ); +var notify = require( 'gulp-notify' ); + +const AUTOPREFIXER_BROWSERS = [ 'last 2 version', '> 1%', 'ie >= 9', 'ie_mob >= 10', 'ff >= 30', 'chrome >= 34', 'safari >= 7', 'opera >= 23', 'ios >= 7', 'android >= 4', 'bb >= 10' ]; + +gulp.task( 'sassTask', function () { + gulp.src( [ './src/scss/file-icon-classic.scss', './src/scss/file-icon-vivid.scss' ] ) + .pipe( sass( { + outputStyle: 'expanded' } ) ) + .on( 'error', console.error.bind( console ) ) + .pipe( autoprefixer ( AUTOPREFIXER_BROWSERS ) ) + .pipe( lineec() ) + .pipe( gulp.dest( './dist') ) + .pipe( filter( '**/*.css' ) ) + .pipe( rename( { suffix: '.min' } ) ) + .pipe( minifycss() ) + .pipe( lineec() ) + .pipe( gulp.dest( './dist' ) ) + .pipe( notify( { message: 'TASK: "sassTask" completed.', onLast: true } ) ); +}); + +gulp.task('default', [ 'sassTask' ], function(){ + var icon_libs = [ './dist/icons/classic', './dist/icons/vivid' ]; + + gulp.watch( './src/scss/*.scss', [ 'sassTask' ] ); + + icon_libs.forEach( function( lib ) { + console.log(lib); + gulp.src( lib + '/*.svg' ).pipe( svgmin() ).pipe( gulp.dest( lib ) ); + }); + +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..eb996b5 --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "file-icon-vectors", + "author": "Daniel M. Hendricks", + "license": "MIT", + "keywords": [ + "file", + "icons", + "vectors", + "svg", + "css" + ], + "devDependencies": { + "gulp": "^3.9.1", + "gulp-svgmin": "^1.2", + "gulp-sass": "^3.1", + "gulp-autoprefixer": "^4.1", + "gulp-filter": "^5.1.0", + "gulp-line-ending-corrector": "^1.0.2", + "gulp-rename": "^1.2.2", + "gulp-uglifycss": "^1.0.9", + "gulp-notify": "^3.2" + }, + "repository": { + "type": "git", + "url": "git://github.com/dmhendricks/file-icon-vectors.git" + } +}