Skip to content

Instantly share code, notes, and snippets.

View adekbadek's full-sized avatar

Adam Cassis adekbadek

View GitHub Profile
@adekbadek
adekbadek / screenshots.coffee
Last active January 26, 2016 13:09 — forked from nhoizey/screenshots.js
Take screenshots at different viewport sizes using CasperJS
###
# Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
# These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
#
# Original gist by nhoizey: https://gist.github.com/nhoizey/4060568
#
# Usage:
# $ casperjs screenshots.coffee [--atf] [--url=URL]
# with SlimerJS - it has better feature support than the default PhantomJS
# $ casperjs --engine=slimerjs test.coffee [--atf] [--url=URL]
module.exports = function(grunt) {
// most basic Grunt config with just livereloading
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
html: {
files: 'index.html',
<!-- DEVELOPMENT -->
<script type="text/javascript" src="js/script.js" ></script>
<!-- END DEVELOPMENT -->
<!-- PRODUCTION
<script type="text/javascript" src="js/script.min.js"></script>
END PRODUCTION -->
module.exports = function(grunt) {
grunt.initConfig({
// (...)
copy:{
// (...)
options: {
process: function (content) {
content = content.replace(/<!-- DEVELOPMENT -->\s*.*\s*<!-- END DEVELOPMENT -->/g,'');
content = content.replace(/<!-- PRODUCTION\s*(.*)\s*END PRODUCTION -->/g, '$1');
return content;