Deprecated: Optional parameter $post_id declared before required parameter $field is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php on line 54

Deprecated: Optional parameter $value declared before required parameter $field is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php on line 166

Deprecated: Optional parameter $post_id declared before required parameter $field is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php on line 166

Deprecated: Optional parameter $key declared before required parameter $value is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/ajax/class-acf-ajax.php on line 76

Deprecated: Optional parameter $i declared before required parameter $post_id is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-repeater.php on line 720

Deprecated: Optional parameter $i declared before required parameter $post_id is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-repeater.php on line 786

Deprecated: Optional parameter $name declared before required parameter $field is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php on line 1038

Deprecated: Optional parameter $i declared before required parameter $post_id is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php on line 1074

Deprecated: Optional parameter $i declared before required parameter $post_id is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php on line 1126

Deprecated: Optional parameter $id declared before required parameter $field is implicitly treated as a required parameter in /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-gallery.php on line 296

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/jwblogger/jwBlogger/wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:54) in /home/jwblogger/jwBlogger/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":446,"date":"2019-01-09T10:58:18","date_gmt":"2019-01-09T17:58:18","guid":{"rendered":"http:\/\/blog.jeffwilkerson.net\/?p=446"},"modified":"2019-01-09T10:58:18","modified_gmt":"2019-01-09T17:58:18","slug":"leveraging-sass-in-wordpress-development","status":"publish","type":"post","link":"https:\/\/blog.jeffwilkerson.net\/2019\/01\/09\/leveraging-sass-in-wordpress-development\/","title":{"rendered":"Leveraging SASS in WordPress Development"},"content":{"rendered":"\n

SASS and CSS-Preprocessing as a whole is absolutely crucial. Having spent many years writing CSS by hand, long before widely accepted standards, I felt so relieve when CSS Preprocessing came along. Most importantly, CSS Preprocessing is another tool that helps facilitate modular web design, and makes it a bit more easier to separate presentation from content.<\/p>\n\n\n\n

For the longest time however, I was confused as to how to use CSS Preprocessing in my WordPress Development. I did a lot of my WP dev work on my personal Windows machine, and just never took the time to figure out how to install all the dependencies. It just never occurred to me to just use NodeJS and Gulp to manage development in a PHP environment until a few years ago.<\/p>\n\n\n\n

Wait, there’s more<\/h2>\n\n\n\n

So using Gulp in WordPress development is nothing new and there are many examples of this online. I want to focus more on how to levgerage a CSS Framework like Zurb’s Foundation or Bootstrap. Both of these frameworks offer raw SASS files complete with a settings \/ option file that you can override, and I’m sure there’s a few ways of customizing these styles into a WordPress theme.<\/p>\n\n\n\n

\"Foundation
Foundation’s settings file that can be customized<\/figcaption><\/figure><\/div>\n\n\n\n

CSS Frameworks like Bootstrap and Foundation can help tremendously with ensuring consistent styling and speeding template development. Both Bootstrap and Foundation have settings files (consisting of variables and mixins) that you can leverage, resulting in two benefits . First, you can override these settings files and compile customized versions of these frameworks. You get all the styles for grids, buttons, navigation, customized to fit your brand design. Second, you can then leverage the variables and mixins in your own work, leading to rapid development of consistent styling. Setting up a workflow so that you can take advantage of these settings is not obvious, which is why I’m documenting my work.<\/p>\n\n\n\n

Basic Setup<\/h2>\n\n\n\n

The basic setup involves creating a NodeJS project, and declaring dependencies such as Gulp. For the sake of this demonstration, I will create this NodeJS project in my theme’s folder. Once my project is set up, I can begin to install the dependencies required to compile SASS. Those dependencies goes as follow:<\/p>\n\n\n\n

\n\t
Gulp<\/a><\/dt>\n\t
Tool used to automate processes<\/dd>\n\n\t\n\t
Node SASS<\/a><\/dt>\n\t
Library to allow for SASS compilation on NodeJS <\/dd>\n\n\t
Gulp SASS<\/a><\/dt>\n\t
SASS plugin for Gulp<\/dd>\n\n\t\n\t
Gulp Autoprefixer<\/a><\/dt>\n\t
Add vendor prefixes to CSS rules; used to make non-standard CSS rules work across browsers <\/dd>\n\n\t\n\t
CSS Nano<\/a><\/dt>\n\t
Minifys CSS<\/dd>\n\n\t\n\t
Gulp Sass Blob<\/a><\/dt>\n\t
Allows globbing patterns in SASS<\/dd>\n\t\n\t
Foundation<\/a><\/dt>\n\t
The CSS Framework I’ll be customizing.<\/dd>\n<\/dl>\n\n\n\n

With these dependencies installed, we can start developing our Gulpfile and SASS assets, and get to the real challenge at hand, importing Foundation into our WordPress theme.<\/p>\n\n\n\n

Gulpfile with ES6 Javascript<\/h2>\n\n\n\n

Hold the presses! Lets use modern Javascript with our gulpfile. When I started this blog post, I had planned to just use the same old gulpFile I had always used. I had been reluctant to use ES6 Javascript simply because I’ve been unclear about all the dependencies needed to compile Gulp with ES6 JS on Windows. Well, it’s 20018 – there are plenty of resources out there that shows how to write ES6 Javascript.<\/p>\n\n\n\n

List of Resources for Using ES6 Javascript in Gulpfiles<\/h4>\n\n\n\n