Skip to content

Instantly share code, notes, and snippets.

@phoenixMag00
Created May 14, 2014 19:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phoenixMag00/680779f6fa15ba9d28ef to your computer and use it in GitHub Desktop.
Save phoenixMag00/680779f6fa15ba9d28ef to your computer and use it in GitHub Desktop.
Grunt File to UNCSS WordPress site
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
exec: {
set_max_files: {
command: 'ulimit -n 1024'
},
get_grunt_sitemap: {
command: 'curl --silent --output sitemap.json http://willimac.com/wp-grunt-test/?show_sitemap'
}
},
uncss: {
dist: {
options: {
ignore : [/expanded/,/js/,/wp-/,/align/,/admin-bar/,'.swing'],
stylesheets : ['http://willimac.com/wp-grunt-test/wp-content/themes/sparkling/inc/css/bootstrap.min.css'],
ignoreSheets : [/fonts.googleapis/],
urls : [], //Overwritten in load_sitemap_and_uncss task
},
files: {
'wp-content/themes/sparkling/inc/css/bootstrap.clean.min.css': ['**/*.html']
}
}
}
});
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-uncss');
grunt.registerTask('default', ['exec:set_max_files','exec:get_grunt_sitemap','load_sitemap_json','uncss:dist']);
grunt.registerTask('load_sitemap_json', function() {
var sitemap_urls = grunt.file.readJSON('./sitemap.json');
grunt.config.set('uncss.dist.options.urls', sitemap_urls);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment