Skip to content

Instantly share code, notes, and snippets.

@mitsuruog
Created December 23, 2015 14:40
Show Gist options
  • Save mitsuruog/eddfcb0081d63154f342 to your computer and use it in GitHub Desktop.
Save mitsuruog/eddfcb0081d63154f342 to your computer and use it in GitHub Desktop.
bootswatchからサムネイルを取得してリサイズするGulpタスク
const gulp = require('gulp');
const imageResize = require('gulp-image-resize');
const remoteSrc = require('gulp-remote-src');
const bootstrapThemes = [
'Cerulean',
'Cosmo',
'Cyborg',
'Darkly',
'Flatly',
'Journal',
'Lumen',
'Paper',
'Readable',
'Sandstone',
'Simplex',
'Slate',
'Spacelab',
'Superhero',
'United',
'Yeti'
].map((theme) => theme.toLowerCase());
gulp.task('bootswatch', () => {
bootstrapThemes.map((theme) => {
remoteSrc(['thumbnail.png'], {
base: `https://bootswatch.com/${theme}/`
})
.pipe(imageResize({
width: 350
}))
.pipe(rename(`${theme}.png`))
.pipe(gulp.dest('thumbnails'))
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment