![]() Gulp, like most build tools, thinks in terms of “tasks,” and more important, how to track the dependencies between those tasks. Seems a little overkill at the moment, but not bad. ![]() Then, from the same directory, issue the stock Gulp command, which (perhaps unsurprisingly) is just “gulp.” Gulp thinks about it for a second, then comes back with: Using gulpfile ~/Projects/code/gulpdemo/gulpfile.js Now, in your text editor of choice, create a new file, called gulpfile.js: const gulp = require('gulp') This will make sure that Gulp is referenced in the package.json file as a developer dependency, so that if you pull down the project you won’t have to remember to install Gulp-it’ll just come along for the ride with the next “npm install” in a fresh environment. Then, in a new directory, create an empty Node.js project by running the following: npm init Install the global Gulp command-line tools (“npm install -g gulp-cli”) first. To get started with Gulp, let’s break away from the scaffolded code from earlier and start from scratch to focus on what (and how) Gulp does what it does. However, because that’s a mouthful and “build tool” just rather rolls off the tongue, let’s go with the idea that Gulp is a build tool for now. ![]() Perhaps a better name for all of them would be “development automation tool,” because that’s more accurate and would include the act of compiling code and assembling it into a deployable artifact. While it’s not exactly fair to call Gulp a “build tool” for a language that doesn’t ever get built (remember, ECMAScript is generally intended to be an interpreted language), that’s really the best terminology you have for a tool that’s intended to be run after (or during) development to make sure everything is lined up and ready to go. But how it works is a little different than any of those three tools, and it deserves discussion as a result. Then, after answering questions as to what tools Yeoman should scaffold into place (for this column, the choices made are mostly irrelevant), and after Yeoman has helpfully kicked off an “npm install” to pull down all the runtime and development dependencies, the scaffolder will report that the application is ready to test by running “gulp test” or “gulp start:server.”Ĭlearly, whatever Gulp is, it’s some kind of build tool, akin in spirit to Make, MSBuild or Ant. ![]() First, make sure Yeoman and the “angular-fullstack” generators are both installed on your Node.js development environment (along with a local running copy of MongoDB): npm install –g yeoman angular-fullstack-generator If you missed my last column, it’s easy enough to catch up. I refer, of course, to the “Gulp” tool used to start the server and open the client browser to the scaffolded client application ( /magazine/mt742874). If you read my last column in October, which talked about the “reboot” of the codebase (by using Yeoman to scaffold out the basics and glue code), you might have noticed that a new tool was thrown into the mix without much explanation. Volume 31 Number 11 How To Be MEAN: Taking a Gulp
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |