mirror of
https://github.com/namibia/file-icon-vectors.git
synced 2024-12-28 02:04:55 +00:00
Upgraded to Gulp 4
This commit is contained in:
parent
7893c7fef3
commit
5ea82ca524
52
gulpfile.js
52
gulpfile.js
@ -10,32 +10,62 @@ var pkg = require( './package.json' );
|
|||||||
var gulp = require( 'gulp' );
|
var gulp = require( 'gulp' );
|
||||||
var rename = require( 'gulp-rename' );
|
var rename = require( 'gulp-rename' );
|
||||||
var minifycss = require( 'gulp-uglifycss' );
|
var minifycss = require( 'gulp-uglifycss' );
|
||||||
|
var imagemin = require( 'gulp-imagemin' );
|
||||||
var sass = require( 'gulp-sass' );
|
var sass = require( 'gulp-sass' );
|
||||||
var autoprefixer = require( 'gulp-autoprefixer' );
|
var autoprefixer = require( 'gulp-autoprefixer' );
|
||||||
|
var cache = require( 'gulp-cache' );
|
||||||
var lineec = require( 'gulp-line-ending-corrector' );
|
var lineec = require( 'gulp-line-ending-corrector' );
|
||||||
var filter = require( 'gulp-filter' );
|
var filter = require( 'gulp-filter' );
|
||||||
var notify = require( 'gulp-notify' );
|
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' ];
|
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.task( 'styles', function() {
|
||||||
gulp.src( [ './src/scss/file-icon-classic.scss', './src/scss/file-icon-vivid.scss', './src/scss/file-icon-square-o.scss', './src/scss/file-icon-vectors.scss' ] )
|
return gulp
|
||||||
.pipe( sass( {
|
.src( [ './src/scss/*.scss', '!./src/scss/_*.scss' ] )
|
||||||
outputStyle: 'expanded' } ) )
|
.pipe(
|
||||||
.on( 'error', console.error.bind( console ) )
|
sass({
|
||||||
|
errLogToConsole: true,
|
||||||
|
outputStyle: 'expanded',
|
||||||
|
precision: 10
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.on( 'error', sass.logError )
|
||||||
.pipe( autoprefixer( AUTOPREFIXER_BROWSERS ) )
|
.pipe( autoprefixer( AUTOPREFIXER_BROWSERS ) )
|
||||||
.pipe( lineec() )
|
.pipe( lineec() )
|
||||||
.pipe( gulp.dest( './dist' ) )
|
.pipe( gulp.dest( './dist' ) )
|
||||||
.pipe( filter( '**/*.css' ) )
|
.pipe( filter( '**/*.css' ) )
|
||||||
.pipe( rename( { suffix: '.min' } ) )
|
.pipe( rename( { suffix: '.min' } ) )
|
||||||
.pipe( minifycss() )
|
.pipe( minifycss( { maxLineLen: 10 } ) )
|
||||||
.pipe( lineec() )
|
.pipe( lineec() )
|
||||||
.pipe( gulp.dest( './dist' ) )
|
.pipe( gulp.dest( './dist' ) )
|
||||||
.pipe( notify( { message: 'TASK: "sassTask" completed.', onLast: true } ) );
|
.pipe( notify({ message: 'TASK: "styles" completed', onLast: true }) );
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', [ 'sassTask' ], function(){
|
gulp.task( 'svgmin', function() {
|
||||||
|
return gulp
|
||||||
gulp.watch( './src/scss/*.scss', [ 'sassTask' ] );
|
.src( './dist/icons/**/*.svg' )
|
||||||
|
.pipe(
|
||||||
|
cache(
|
||||||
|
imagemin([
|
||||||
|
imagemin.svgo({
|
||||||
|
plugins: [ { removeViewBox: true }, { cleanupIDs: true } ]
|
||||||
|
})
|
||||||
|
])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.pipe( gulp.dest( './dist/icons' ) )
|
||||||
|
.pipe( notify({ message: 'TASK: "svgmin" completed.', onLast: true }) );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
'default',
|
||||||
|
gulp.parallel(
|
||||||
|
'styles',
|
||||||
|
'svgmin',
|
||||||
|
function watchFiles() {
|
||||||
|
gulp.watch( './assets/css/**/*.scss', gulp.parallel( 'styles' ) );
|
||||||
|
//gulp.watch( './dist/icons/**/*.svg', gulp.parallel( 'svgmin' ) );
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
16
package.json
16
package.json
@ -9,16 +9,20 @@
|
|||||||
"icons",
|
"icons",
|
||||||
"vectors",
|
"vectors",
|
||||||
"svg",
|
"svg",
|
||||||
"css"
|
"css",
|
||||||
|
"sass",
|
||||||
|
"logo"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^4.0",
|
||||||
"gulp-autoprefixer": "^4.1",
|
"gulp-autoprefixer": "^4.1.0",
|
||||||
"gulp-filter": "^5.1.0",
|
"gulp-filter": "^5.1.0",
|
||||||
|
"gulp-imagemin": "^4.1.0",
|
||||||
"gulp-line-ending-corrector": "^1.0.2",
|
"gulp-line-ending-corrector": "^1.0.2",
|
||||||
"gulp-notify": "^3.2",
|
"gulp-cache": "^1.0.2",
|
||||||
"gulp-rename": "^1.3.0",
|
"gulp-notify": "^3.1",
|
||||||
"gulp-sass": "^3.2.1",
|
"gulp-rename": "^1.4.0",
|
||||||
|
"gulp-sass": "^4.0",
|
||||||
"gulp-uglifycss": "^1.1.0"
|
"gulp-uglifycss": "^1.1.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
Loading…
Reference in New Issue
Block a user