Skip to content

Instantly share code, notes, and snippets.

@bradfrost
Last active August 29, 2015 13:57
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bradfrost/9856884 to your computer and use it in GitHub Desktop.
Save bradfrost/9856884 to your computer and use it in GitHub Desktop.
Using Grunt with Pattern Lab
module.exports = function(grunt) {
// Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
patternlab: {
command: "php core/builder.php -gp"
}
},
watch: {
html: {
files: ['source/_patterns/**/*.mustache', 'source/_patterns/**/*.json', 'source/_data/*.json'],
tasks: ['shell:patternlab'],
options: {
spawn: false
}
}
}
});
// Plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-shell');
// Tasks
grunt.registerTask('default', ['watch', 'shell:patternlab']);
};
@bradfrost
Copy link
Author

This is more or less the Gruntfile.js configuration for using Pattern Lab with Grunt.

In order to use Pattern Lab with Grunt, you need to install the Grunt Shell plugin, then set up a task for Pattern Lab to build every time a change is made to a .mustache or .json file.

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