

You may also want to consider a library like SVG For Everybody. I had to modify it a bit to point to the proper URL (MyTheme + /assets/svg/png/”), but it works fairly well. For these fallbacks, I use a script from Luke Whitehouse.
#Npm gulp and express livereload how to#
From there, you can follow the article linked above for how to include this in your theme. The final sprite will be saved to assets/svg as. You will notice that I passed an svgo transformation, which will automatically optimize the SVG files. svg extension, and then processing it using the svg-sprite library. Gulpfile.js gulp.task('sass', function () ) )Īs our source, we are simply looking in the ‘assets/svg/individual’ folder for anything with an. Create a new file in the root directory titled gulpfile.js and at the very top add: With that, we can finally start setting up Gulp.
#Npm gulp and express livereload install#
The first thing we’ll need to do is install gulp-sass, a library which will compile SASS down into plain old CSS.

Hopefully this will be a bit more clear as we step through.įrom here, it’s just a matter of installing the packages we need, and creating a gulp task for each one.


With Node installed, you can install gulp globally on your system by opening up your Terminal and running: npm install -g gulp If you’re not set up with Node yet, I’d recommend following the steps on their website (or better yet, installing Homebrew). Setting Things Upįirst off, gulp runs on top of NodeJS, and is generally operated from the command line. But by the end you’ll be compiling SASS, minifying Javascript, working with livereload and implementing a SVG icon system. My goal was to write a short introduction to how this works. For those unaware, Gulp is a slick JavaScript task runner, which can be used to concatenate JS and CSS files, lint files, and generally automate your front-end workflow. For a little while now, I’ve been using Gulp in my WordPress themes to automate my front-end workflow and add some handy helpers along the way.
