Skip to content

Instantly share code, notes, and snippets.

Created June 1, 2014 10:43
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jegtnes/780e68e85b7ca8008079 to your computer and use it in GitHub Desktop.
The Gulpfile I created for the blogpost, detailing how to use UnCSS and Gulp for Ghost.
var gulp = require('gulp');
var sass = require('gulp-sass'); // skip this if you're working with vanilla CSS
var rename = require('gulp-rename');
var cmq = require('gulp-combine-media-queries');
var uncss = require('gulp-uncss');
var download = require('download');
var cssmin = require('gulp-cssmin');
var clean = require('gulp-clean');
var xml2js = require('gulp-xml2js');
// Upon runnning styles-build, this will be populated with all blog posts too
// See tasks find-site-files, create-sitemap, and download-rss-feed
var filesToUncss = [
gulp.task('styles-build', ['find-site-files'], function() {
return gulp.src('scss/style.scss') //you probably want to change this
.pipe(sass()) // skip this if you're working with vanilla CSS
.pipe(rename({suffix: '.min'}))
html: filesToUncss
gulp.task('download-rss-feed', function(callback) {
dl = download({
url: '',
name: 'rss.xml'
}, './')
dl.once('close', function() {
gulp.task('create-sitemap', ['download-rss-feed'], function() {
return gulp.src('./rss.xml')
gulp.task('find-site-files', ['create-sitemap'], function() {
var json = require('./rss.json');[0].item.forEach(function(value) {
link =[0]
return gulp.src(['rss.json', 'rss.xml'], {read: false})
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['styles-build']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment