Automating WordPress Plugin Development with Gulp

50
Automating WordPress Plugin Development with Gulp @MikeHale #wcstl

Transcript of Automating WordPress Plugin Development with Gulp

Page 1: Automating WordPress Plugin Development with Gulp

Automating WordPress Plugin Development with

Gulp

@MikeHale #wcstl

Page 2: Automating WordPress Plugin Development with Gulp

About MikeMike HaleDeveloperRainmaker Digital

@MikeHalewww.mikehale.me

Page 3: Automating WordPress Plugin Development with Gulp

What You’ll Learn

What Gulp IsGulp Vs. GruntTasksGulp PluginsStarter Plugin

Page 4: Automating WordPress Plugin Development with Gulp

Modern Designer’s Workflow

Page 5: Automating WordPress Plugin Development with Gulp
Page 6: Automating WordPress Plugin Development with Gulp
Page 7: Automating WordPress Plugin Development with Gulp
Page 8: Automating WordPress Plugin Development with Gulp
Page 9: Automating WordPress Plugin Development with Gulp
Page 10: Automating WordPress Plugin Development with Gulp

Modern Developer’s

Workflow

Page 11: Automating WordPress Plugin Development with Gulp

From Idea to Release

Page 12: Automating WordPress Plugin Development with Gulp

Creating a Plugin

Page 13: Automating WordPress Plugin Development with Gulp

Gulp.js to the Rescue!

Page 14: Automating WordPress Plugin Development with Gulp

What is Gulp?

Gulp is a Javascript task runner that lets you

automate common or repetitive tasks

Page 15: Automating WordPress Plugin Development with Gulp

Gulp vs. Grunt

Page 16: Automating WordPress Plugin Development with Gulp

Streams(In Memory)

Temp Files(I/O)

Page 17: Automating WordPress Plugin Development with Gulp

Code Style Config Style

Page 18: Automating WordPress Plugin Development with Gulp

2,379 Plugins

5,691Plugins

Page 19: Automating WordPress Plugin Development with Gulp

Faster?

Page 20: Automating WordPress Plugin Development with Gulp

“Gulp vs Grunt doesn’t matter as long as whichever

Tool you choose makes you more productive"

@MikeHale

Page 21: Automating WordPress Plugin Development with Gulp

Installing Gulp

Install Node.js

Install Gulp.js

npm install --save-dev gulp

Page 22: Automating WordPress Plugin Development with Gulp

gulpfile.js

Page 23: Automating WordPress Plugin Development with Gulp

gulpfile.js

Page 24: Automating WordPress Plugin Development with Gulp

gulp.task

Page 25: Automating WordPress Plugin Development with Gulp

gulp.task( name, function() {// src// pipe// dest

});

Page 26: Automating WordPress Plugin Development with Gulp

gulp.src

Page 27: Automating WordPress Plugin Development with Gulp

gulp.src( ‘*.php’ )

Page 28: Automating WordPress Plugin Development with Gulp

gulp.pipe

Page 29: Automating WordPress Plugin Development with Gulp

gulp.pipe( dothis() ) .pipe( dothat() );

Page 30: Automating WordPress Plugin Development with Gulp

gulp.dest

Page 31: Automating WordPress Plugin Development with Gulp

gulp.dest( ‘/folder’ )

Page 32: Automating WordPress Plugin Development with Gulp

gulp.watch

Page 33: Automating WordPress Plugin Development with Gulp

gulp.watch( ‘*.php’, ‘task’

)

Page 34: Automating WordPress Plugin Development with Gulp

My Starter Plugin

Page 35: Automating WordPress Plugin Development with Gulp

WordPress-Plugin-Boilerplate

http://wppb.io

+ File Structure+ Standards Based

- No Auto Translations- Manually rename files- No js/css Automation

Page 36: Automating WordPress Plugin Development with Gulp

generator-plugin-wp

+ Yoeman Generator+ Sub-generators+ Powerful

- Complex- Requires Yoeman

Page 37: Automating WordPress Plugin Development with Gulp

config.json (Settings)

Page 38: Automating WordPress Plugin Development with Gulp

gulp-token-replace

Page 39: Automating WordPress Plugin Development with Gulp

Tokens

Page 40: Automating WordPress Plugin Development with Gulp

Tokens

Page 41: Automating WordPress Plugin Development with Gulp

gulp-sass

Page 42: Automating WordPress Plugin Development with Gulp

gulp.concat, gulp.uglify

Page 43: Automating WordPress Plugin Development with Gulp

gulp-wp-pot

Page 44: Automating WordPress Plugin Development with Gulp

Output

Page 45: Automating WordPress Plugin Development with Gulp

Default Task

Page 46: Automating WordPress Plugin Development with Gulp

_PLUGIN Files_PLUGIN.phpclasses/class._PLUGIN.phpincludes/_PLUGIN-shortcodes.phpwidgets/_PLUGIN-widget.php

Page 47: Automating WordPress Plugin Development with Gulp

Starter Plugin FeaturesWidgetShortcodesFunctionsClasses AutoloaderOutput/Dev FoldersActivate/Deactivate/UninstallReadme.md

Page 48: Automating WordPress Plugin Development with Gulp

Other Optionsgulp-watchgulp-exec (WP-CLI, PHPCS*)gulp-imagemin (Optimize Images )gulp-livereload (Live Reload)gulp-zip (Compress Plugin)

Page 49: Automating WordPress Plugin Development with Gulp

http://github.com/mikejhale/starter-plugin

@MikeHale #wcstl

Page 50: Automating WordPress Plugin Development with Gulp

About MikeMike HaleDeveloperRainmaker Digital

@MikeHalewww.mikehale.me