Skip to content

Instantly share code, notes, and snippets.

@topdown
Last active April 10, 2016 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topdown/940a0af716fc386517ed2169fa7ffc4f to your computer and use it in GitHub Desktop.
Save topdown/940a0af716fc386517ed2169fa7ffc4f to your computer and use it in GitHub Desktop.
Network wide WordPress theme development
// http://mattbanks.me/grunt-wordpress-development-deployments/
// https://github.com/mattbanks/WordPress-Starter-Theme/blob/master/Gruntfile.js
'use strict';
module.exports = function (grunt) {
// load all grunt tasks matching the `grunt-*` pattern
require('load-grunt-tasks')(grunt);
var $proxy = 'vvv_domain.dev';
grunt.initConfig({
// watch for changes and trigger sass, jshint, uglify and livereload
watch: {
// sass: {
// files: ['src/compass/sass/**/*.{scss,sass}'],
// tasks: ['sass']
// },
html: {
files: ['**/*.{html,php}']
},
css: {
files: ['style.css']
}
},
// sass
// sass: {
// dist: {
// options: {
// style: 'expanded'
// },
// files: {
// 'style.css': 'src/compass/sass/style.scss'
// //'editor-style.css': 'src/compass/sass/editor-style.scss'
// }
// }
// },
// autoprefixer
autoprefixer: {
options: {
browsers: ['last 2 versions', 'ie 9', 'ios 6', 'android 4'],
map: true
},
files: {
expand: true,
flatten: true,
src: '*.css',
dest: 'src/css'
}
},
// css minify
cssmin: {
options: {
keepSpecialComments: 1
},
minify: {
expand: true,
cwd: '',
src: ['*.css', '!*.min.css'],
ext: '.css'
}
},
// image optimization
// imagemin: {
// dist: {
// options: {
// optimizationLevel: 7,
// progressive: true,
// interlaced: true
// },
// files: [{
// expand: true,
// cwd: 'src/img/',
// src: ['**/*.{png,jpg,gif}'],
// dest: 'src/images/'
// }]
// }
// },
// browserSync
browserSync: {
dev: {
bsFiles: {
src: ['style.css', '**/*.{html,php}']
},
options: {
proxy: $proxy,
watchTask: true,
browser: "google chrome"
}
}
}
});
// rename tasks
grunt.renameTask('rsync', 'deploy');
grunt.registerTask('default', ['browserSync', 'watch']);
};
{
"name": "your_theme",
"version": "1.0.0",
"description": "",
"main": "Gruntfile.js",
"dependencies": {
"grunt": "^0.4.5",
"grunt-autoprefixer": "^3.0.3",
"grunt-contrib-cssmin": "^0.13.0",
"grunt-browser-sync": "^2.1.3",
"grunt-contrib-sass": "^0.9.2",
"grunt-rsync": "^0.6.2",
"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-watch": "^0.6.1",
"grunt-spritesmith": "^5.2.0",
"load-grunt-tasks": "^3.2.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
@MickeyKay
Copy link

Wow, if this works. . . awesome! Thanks Jeff!

@topdown
Copy link
Author

topdown commented Apr 10, 2016

@MickeyKay let me know how it works for you. I have been using this setup a lot.
Mac OSX as the VVV setup where I develop and then viewing across the network on all devices and machines for browser testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment