Created
May 14, 2014 19:27
-
-
Save phoenixMag00/680779f6fa15ba9d28ef to your computer and use it in GitHub Desktop.
Grunt File to UNCSS WordPress site
This file contains 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
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