{"id":9,"date":"2019-08-09T13:15:00","date_gmt":"2019-08-09T13:15:00","guid":{"rendered":"https:\/\/dev.kloclabs.com\/?p=9"},"modified":"2023-11-10T11:02:10","modified_gmt":"2023-11-10T11:02:10","slug":"16-awesome-gulp-plugins","status":"publish","type":"post","link":"https:\/\/kloclabs.com\/16-awesome-gulp-plugins\/","title":{"rendered":"16 awesome gulp plugins which will improve your workflow"},"content":{"rendered":"\n
I used to be the kind of person who would just write some code, then shove it on a web server. I now know the error of my ways, a build process can really help either reduce your workload (If you’re already doing the things manually) or even better automate things you didnt even think (or know) you needed.<\/p>\n
To achieve this, I usually use Gulp<\/a>. This tool lets you string a build process together. So let me give you an example: You want to minify all files, create source maps of your CSS and JS, create new version numbers for your assets, compress images, create your favicons etc. All this and much more can be done in a single command.<\/p>\n So I thought I would talk about a few of the Gulp plugins I use for my build process. I’ll split them down by styles, scripts, html etc.<\/p>\n This plugin compiles your SASS into a CSS file. (If you couldn’t guess from it’s name). This is super useful, as you can write your styles in sass and this will compile it into CSS. This can be either on the fly with browsersync (we’ll talk about this later) or when you build the final project.<\/p>\n This plugin lets you minify your CSS within your build process. Minification enables a file to be smaller by removing whitespace and linebreaks, update variable names to be shorter, removing comments and changing some functions be less readable. (Such as changing the boolean false to !1).<\/p>\n This generates your critical CSS from your CSS and adds it to the <head> section. If you want some tips on how to improve your page speed. I have talked about this on a previous blog post<\/a>. <\/p>\n This plugin is one of my favourites. It adds browser specific prefixes so you don’t have to. So for instance using the CSS ‘border-radius’, you may also want to include ‘-webkit-border-radius’, your gulp build process will add this for you.<\/p>\n This is very similar to gulp-cssnano but it is used for JS. It minifies your scripts to help speed up your PLS, and speeds up execution times. <\/p>\n This plugin tests your JS, it looks for any errors, looks for any unused variables or arguments. It can also fix any issues if you want it to. There are also various ESLint plugins which can detect problems with libraries too. The example below is an AngularJS app. <\/p>\n\n\n\n\nStyles<\/h2>\n
gulp-sass<\/a><\/h3>\n
gulp-cssnano<\/a><\/h3>\n
critical<\/a><\/h3>\n
autoprefixer<\/a><\/h3>\n
Scripts<\/h2>\n
gulp-uglify<\/a><\/h3>\n
gulp-eslint<\/a><\/h3>\n