Skip to content

Instantly share code, notes, and snippets.

@joecue
Created July 18, 2015 20:27
Show Gist options
  • Save joecue/6d1e65a660ab647906d0 to your computer and use it in GitHub Desktop.
Save joecue/6d1e65a660ab647906d0 to your computer and use it in GitHub Desktop.
Sample Grunt File
module.exports = function(grunt) {
SOURCE_DIR = '',
BUILD_DIR = '../../wwwroot-wp_demo_theming/wp-content/themes/demo-theme',
// Configuration Info
grunt.initConfig({
sass: {
dev: {
options: {
style: 'expanded',
sourcemap: 'none',
},
files: {
'style_readable.css' : 'scss/custom.scss'
}
},
dist: {
options: {
style: 'compressed',
sourcemap: 'none',
},
files: {
'custom.css' : 'scss/custom.scss'
}
}
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
options: {
globals: {
jQuery: true
}
}
},
phplint: {
options: {
phpArgs: {
"-lf": null
}
},
all : {
src: ['*.php', '**/*.php']
}
},
copy: {
css: {
files: [{
expand: true,
cwd:SOURCE_DIR,
src: 'custom.css',
dest: BUILD_DIR
}],
},
php: {
files: [{
expand: true,
cwd:SOURCE_DIR,
src: '**/*.php',
dest: BUILD_DIR
}],
},
screenshot: {
files: [{
expand: true,
cwd:SOURCE_DIR,
src: '*.png',
dest: BUILD_DIR
}],
},
},
watch: {
scripts: {
files: '**/*.js',
tasks: ['jshint'],
},
php: {
files: '**/*.php',
tasks: ['phplint', 'copy:php'],
},
css: {
files: '**/*.scss',
tasks: ['sass', 'copy:css'],
},
lr: {
options: {
livereload: true
},
files: ['**/*.js', '**/*.php', '**/*.css'],
},
},
});
// Load Plugins
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-phplint');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
// Define Tasks
grunt.registerTask('default', ['watch']);
};
{
"name": "demo-wordcamp_final",
"version": "1.0.0",
"description": "WordCamp Demo Final WordPress Theme",
"main": "Gruntfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-phplint": "0.0.5",
"grunt-sass": "^1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment