Integration with Grunt/Gulp
Note: These directions may be incomplete. They also require v0.7.9 of the PHP version of Pattern Lab.
Setting up Grunt to work with the PHP version of Pattern Lab should be straightforward. To do so please do the following:
- Open a terminal window
- Type
npm install --save-dev grunt-shellto install grunt-shell - Add the following to your
grunt.initConfig. The-pflag ensures that Pattern Lab only generates patterns.
shell: {
patternlab: {
command: "php core/builder.php -gp"
}
}- Add
grunt.loadNpmTasks('grunt-shell');to your list of plugins. - Add
'shell:patternlab'to your list of tasks ingrunt.registerTask.
You should also be using grunt-contrib-watch to monitor changes to Pattern Lab's patterns and data. The Pattern Lab section for your watch might look like:
html: {
files: ['source/_patterns/**/*.mustache', 'source/_patterns/**/*.json', 'source/_data/*.json'],
tasks: ['shell:patternlab'],
options: {
spawn: false
}
}
You might be able to use livereload as well but that hasn't been tested by us yet.
For more information, check out this post about using Pattern Lab with Grunt.