{"id":1329,"date":"2018-01-08T19:08:13","date_gmt":"2018-01-09T00:08:13","guid":{"rendered":"http:\/\/bluegalaxy.info\/codewalk\/?p=1329"},"modified":"2018-01-08T19:08:13","modified_gmt":"2018-01-09T00:08:13","slug":"javascript-install-gulp-via-npm","status":"publish","type":"post","link":"https:\/\/bluegalaxy.info\/codewalk\/2018\/01\/08\/javascript-install-gulp-via-npm\/","title":{"rendered":"JavaScript: How to install Gulp via NPM"},"content":{"rendered":"<p>Gulp is a Node.js package that acts as a plugin to automate all kinds of web development workflow tasks. According to the official <a href=\"https:\/\/gulpjs.com\/\">gulp website<\/a>:<\/p>\n<blockquote><p>gulp is a toolkit for automating painful or time-consuming tasks in your development workflow, so you can stop messing around and build something.<\/p><\/blockquote>\n<p>To install Gulp, we need to install it globally (so that the command line will know what we mean when we type &#8216;gulp&#8217; outside of any projects) and locally for specific projects.<\/p>\n<p><strong>Install Gulp globally<\/strong><\/p>\n<p>In the bash window, type:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">npm install gulp-cli --global<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone wp-image-1330 size-full\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/install_gulp_globally.png\" alt=\"\" width=\"940\" height=\"78\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/install_gulp_globally.png 940w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/install_gulp_globally-300x25.png 300w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/install_gulp_globally-768x64.png 768w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/install_gulp_globally-676x56.png 676w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>Notice that this created a gulp.js file on my system in the same path that npm was installed.<\/p>\n<p>To check that the installation was successful, type this command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">gulp<\/pre>\n<p>We should see the message &#8220;No gulpfile found&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone wp-image-1331 size-full\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/no_gulpfile_found.png\" alt=\"\" width=\"489\" height=\"50\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/no_gulpfile_found.png 489w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/no_gulpfile_found-300x31.png 300w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><\/p>\n<p><strong>Install Gulp to a project<br \/>\n<\/strong><\/p>\n<p>To use gulp in a project, we need to have gulp listed in our package.json file. To do this, fisrs cd to the project root location and then type the following in the bash command window:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">npm install gulp --save-dev<\/pre>\n<p>What this does is place gulp into the devDependencies section of the package.json file. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\">{\r\n  \"name\": \"travel-site\",\r\n  \"version\": \"1.0.0\",\r\n  \"dependencies\": {\r\n    \"jquery\": \"3.2.1\",\r\n  },\r\n  \"devDependencies\": {\r\n    \"gulp\": \"3.9.1\",\r\n  }\r\n}<\/pre>\n<p>We can check the version number to ensure that it was installed:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">gulp -v<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone wp-image-1334 size-full\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/gulp_version.png\" alt=\"\" width=\"492\" height=\"65\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/gulp_version.png 492w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/01\/gulp_version-300x40.png 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/p>\n<p>With that confirmation, gulp is ready to be used in web development projects!<\/p>\n<p>The official gulp website is here:<br \/>\n<a href=\"https:\/\/gulpjs.com\/\">https:\/\/gulpjs.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gulp is a Node.js package that acts as a plugin to automate all kinds of web development workflow tasks. According to the official gulp website: gulp is a toolkit for automating painful or time-consuming tasks in your development workflow, so you can stop messing around and build something. To install Gulp, we need to install &hellip; <a href=\"https:\/\/bluegalaxy.info\/codewalk\/2018\/01\/08\/javascript-install-gulp-via-npm\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">JavaScript: How to install Gulp via NPM<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[92,45,91],"class_list":["post-1329","post","type-post","status-publish","format-standard","hentry","category-javascript-language","tag-gulp","tag-javascript","tag-npm"],"_links":{"self":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/1329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/comments?post=1329"}],"version-history":[{"count":4,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/1329\/revisions"}],"predecessor-version":[{"id":1336,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/1329\/revisions\/1336"}],"wp:attachment":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/media?parent=1329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/categories?post=1329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/tags?post=1329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}