{"id":116,"date":"2014-10-31T22:56:40","date_gmt":"2014-10-31T22:56:40","guid":{"rendered":"http:\/\/kopijunkie.net\/blog\/?p=116"},"modified":"2015-01-29T23:39:27","modified_gmt":"2015-01-29T23:39:27","slug":"grunt-timekeeping","status":"publish","type":"post","link":"https:\/\/kopijunkie.net\/blog\/2014\/10\/31\/grunt-timekeeping\/","title":{"rendered":"Grunt Timekeeping"},"content":{"rendered":"<p>Recently I added a Grunt plugin to the front end workflow we have at work that handily displays a summary of the time taken by a project&#8217;s Grunt build tasks. Before this the team had only been aware of the overall time taken. Especially with LiveReload running, waiting for the page to reload with our changes.<\/p>\n<p>We suspected the Compass compilation was taking &#8220;a long time&#8221;. But we didn&#8217;t know for certain how long and if that was the only problem area. With <a href=\"https:\/\/github.com\/sindresorhus\/time-grunt\" title=\"time-grunt Github repository\">time-grunt<\/a> we could now see a nice breakdown of each task&#8217;s time taken allowing us to know what to focus our performance improvements on.<br \/>\n<!--more--><\/p>\n<p>Setting it up was easy enough. Though it is slightly different from the usual Grunt tasks. Just install it using NPM and save it into the project&#8217;s <code>package.json<\/code> as a development dependency with <code>npm install time-grunt --save-dev<\/code> in the project&#8217;s front end root directory. Then in your project&#8217;s <code>Gruntfile.js<\/code> add <code>time-grunt<\/code> as a required module and pass it the Grunt instance with <code>require(\"time-grunt\")(grunt);<\/code><\/p>\n<div id=\"attachment_120\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/res.cloudinary.com\/kopijunkie\/image\/upload\/v1422574767\/Screen-Shot-2014-10-31-at-23.58.51_tohn6r.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-120\" src=\"http:\/\/res.cloudinary.com\/kopijunkie\/image\/upload\/h_95,w_300\/v1422574767\/Screen-Shot-2014-10-31-at-23.58.51_tohn6r.png\" alt=\"time-grunt task output\" width=\"300\" height=\"95\" class=\"size-medium wp-image-120\" \/><\/a><p id=\"caption-attachment-120\" class=\"wp-caption-text\">time-grunt task output<\/p><\/div>\n<p>Now when you run Grunt again, at the end of your Grunt output there will be a nice time chart broken down by tasks reporting how long each task took with a total run time also. Sweet!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I added a Grunt plugin to the front end workflow we have at work that handily displays a summary of the time taken by a project&#8217;s Grunt build tasks. Before this the team had only been aware of the overall time taken. Especially with LiveReload running, waiting for the page to reload with our [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,19],"tags":[34,33],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-front-end-development","category-workflow","tag-front-end-workflow","tag-grunt"],"_links":{"self":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":6,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/posts\/116\/revisions\/138"}],"wp:attachment":[{"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kopijunkie.net\/blog\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}