This will install the packages as dev dependencies. To install the packages all together, run the following command: npm i gulp gulp-rename gulp-terser gulp-clean-css -D These are the packages you'll need in order to minify JavaScript and CSS files: Now you need to tell npm to install a few packages for you. Or you can run this command, which will skip all the questions and just use the default values that npm provides: npm init -yĮither way, you'll be left with a shiny new file called package.json. You can either run the following command, which will guide you through naming the fields: npm init my-project in this case) and keeps track of information about your project, such as its name, version, author, code dependencies, etc. This is a file that sits in the root of your project (the top-level folder, i.e. Once there, you need to create a package.json file. Navigate to that folder in your terminal window. Let's pretend you're working on a project saved in a folder called my-project. If you already have a package.json file configured, you can skip this step. Next, you'll need to create a package.json file if you haven't already. This will make the package available globally, not just for your current project: npm i gulp-cli -g Then run the following command in your terminal window to install the command-line utility. If you've previously installed gulp globally, run npm rm -global gulp before following these instructions. Once you've done that, you can install the command-line utility.įirst, a quick note as explained in the Quick Start guide for gulp: If you don't have Node.js and npm installed, you'll need to get those first you can learn how to do that in the get npm guide. Install the command-line utility for gulpįirst, you need to open a new terminal window and install the command-line utility for gulp. I couldn't seem to find such a basic tutorial on the web that was explained in simple terms. This encompasses many things, but let's focus on a basic use case for minifying JavaScript and CSS files. Gulp is a toolkit for automating painful or time-consuming tasks in your development workflow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |