{"id":2648,"date":"2014-01-04T02:13:20","date_gmt":"2014-01-04T06:13:20","guid":{"rendered":"http:\/\/patorjk.com\/blog\/?p=2648"},"modified":"2014-01-04T02:13:20","modified_gmt":"2014-01-04T06:13:20","slug":"figlet-and-grunt-figlet-npm-packages","status":"publish","type":"post","link":"https:\/\/patorjk.com\/blog\/2014\/01\/04\/figlet-and-grunt-figlet-npm-packages\/","title":{"rendered":"figlet and grunt-figlet npm packages"},"content":{"rendered":"<p>Last month I discovered <a href=\"http:\/\/gruntjs.com\/\">Grunt<\/a>, which is described as a &#8220;JavaScript task runner&#8221; by its creators. What&#8217;s that mean? Well, it allows you to automate mundane tasks like JS-linting, JavaScript\/CSS minifying, compiling LESS into CSS, watching files for updates, and other development tasks. I had personally been using makefiles for these types of tasks, but after coming across a Grunt plugin for <a href=\"https:\/\/github.com\/ericclemmons\/grunt-angular-templates\">inlining AngularJS templates<\/a>, I ended up going down the Grunt rabbit hole and converting over my makefiles to gruntfiles.<\/p>\n<p>Once I had everything working with Grunt, I thought it might be fun to try and write my own plugin. Since Grunt is node.js based, I decided it might be neat to use the <a href=\"https:\/\/github.com\/patorjk\/figlet.js\">figlet.js<\/a> library I wrote a while back to auto-generate ASCII banners for source code files. figlet.js was originally written to be browser-side only, so I had to do a little reworking to get it to work with node. However, after I had created an npm package for it, I wrote a simple grunt plugin around it called <a href=\"https:\/\/github.com\/patorjk\/grunt-figlet\">grunt-figlet<\/a>. You can the result of a test run of the plugin below.<\/p>\n<pre>\r\n\/**\r\n * _________            .___      \r\n * \\_   ___ \\  ____   __| _\/____  \r\n * \/    \\  \\\/ \/  _ \\ \/ __ |\/ __ \\ \r\n * \\     \\___(  <_> ) \/_\/ \\  ___\/ \r\n *  \\______  \/\\____\/\\____ |\\___  >\r\n *         \\\/            \\\/    \\\/ \r\n * This is a message for the comment body.\r\n * More random text...\r\n *\/\r\nfunction abc(a,b,c){console.log(a+b+c);}var a=1,b=2,c=3;abc(a,b,c);\r\n<\/pre>\n<p>My office mate pointed out that it sort of defeats the purpose of minifying, but I still think its cool. The <a href=\"http:\/\/patorjk.com\/software\/taag\/#p=moreopts\">Text to ASCII Art Geneartor<\/a> has a similar code comment feature, though it supports more languages. I&#8217;ll probably add support for other commenting styles into the grunt plugin later on, though right now I&#8217;m not sure if Grunt is used for any non-web development type projects.<\/p>\n<p>After posting the project up someone submitted a change to allow the figlet library to work at the command line. However, I decided to break it out into its <a href=\"https:\/\/github.com\/patorjk\/figlet-cli\">own package<\/a>, so someone could use the library without it interfering with an existing installation of figlet. Ultimately I think it would be cool if this command line app mirrored the behavior of the c-based app. I mentioned the idea on the figlet mailing list, and Ian (the I in FIGlet) seemed to like idea. However, unless there&#8217;s suddenly a bunch of interest, right now that&#8217;s low on my list of things to do (though if you&#8217;re up for the task, feel free to submit changes to it).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last month I discovered Grunt, which is described as a &#8220;JavaScript task runner&#8221; by its creators. What&#8217;s that mean? Well, it allows you to automate mundane tasks like JS-linting, JavaScript\/CSS minifying, compiling LESS into CSS, watching files for updates, and other development tasks. I had personally been using makefiles for these types of tasks, but &hellip; <a href=\"https:\/\/patorjk.com\/blog\/2014\/01\/04\/figlet-and-grunt-figlet-npm-packages\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">figlet and grunt-figlet npm packages<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,21,32],"tags":[],"class_list":["post-2648","post","type-post","status-publish","format-standard","hentry","category-development-thoughts","category-javascript","category-web-development"],"_links":{"self":[{"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/posts\/2648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/comments?post=2648"}],"version-history":[{"count":14,"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/posts\/2648\/revisions"}],"predecessor-version":[{"id":2662,"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/posts\/2648\/revisions\/2662"}],"wp:attachment":[{"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/media?parent=2648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/categories?post=2648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/patorjk.com\/blog\/wp-json\/wp\/v2\/tags?post=2648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}