Last active
August 29, 2015 14:24
-
-
Save willread/6ebdb478aef35508c246 to your computer and use it in GitHub Desktop.
Gulp task to scale all css pixel values down by 10%
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 replace = require('gulp-replace'); | |
gulp.task('resizeCSS', function() { | |
gulp.src(['clients/unata/styles/*.styl', 'clients/unata/styles/**/*.styl']) | |
.pipe(replace(/([0-9]+\.?[0-9]*)px/g, function(match, size) { | |
if(size > 0){ | |
size = Math.max(1, Math.round(size * 0.9)); | |
} | |
return size + 'px'; | |
})) | |
.pipe(gulp.dest('clients/unata/styles')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment