Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPete Cass
16,656 PointsWordpress - the Gulp way
Hey,
I recently started learning wordpress and am after some advice / tips on a development workflow. I use Gulp a lot and have an awesome process for building static sites but I'm struggling to figure out an easy way to bring that process over to wordpress.
At the moment my process works fine for the development phase but is there an easy way I could update the config file to link to minified styles / scripts in the production phase?
Any tips or resources would be greatly appreciated :)
2 Answers
Colin Marshall
32,861 PointsOne possible way is to set a variable in your wp-config like this:
<?php
define('IS_DEV', false);
?>
Set it to false on your production config and true in development config. Then in your functions.php you can write a function that will strip the ".min" from the paths to your scripts/stylesheets if IS_DEV
is true. You might want to store them all in an associative array and then reference the array in enqueue calls.
Pete Cass
16,656 PointsThanks Colin I'll try that