Ryan Langton
Ryan Langton

Reputation: 6160

NPM auto-install gulp components

I'm setting up gulp to do tasks to my JS files in a legacy .NET WebForms project. I have installed NPM, which I then used to install Gulp, and I can successfully run gulp which executes my gulpfile.js. Now I have dependencies to install using npm, like gulp-concat, gulp-uglify, etc. I don't want every developer who opens the solution to have to type "npm install xlibrary" for every dependency. Is there a way to have npm install a list of dependencies, perhaps through a config file (I think VS 2015 does it this way)?

Upvotes: 0

Views: 187

Answers (1)

Riad Baghbanli
Riad Baghbanli

Reputation: 3319

Create package.json file containing

{
  "name": "my-web-app",
  "description": "Hello world app",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "bower": "^1.4.1",
    "del": "^1.2.0",
    "gulp": "^3.9.0",
    "gulp-add-src": "^0.2.0",
    "gulp-concat": "^2.6.0",
    "gulp-csso": "^1.0.0",
    "gulp-filter": "^2.0.2",
    "gulp-main-bower-files": "^1.2.0",
    "gulp-rename": "^1.2.2",
    "gulp-ruby-sass": "^1.0.5",
    "gulp-sourcemaps": "^1.5.2",
    "gulp-typescript": "^2.7.8",
    "gulp-uglify": "^1.2.0"
  }
}

In that file you write out all the dependancies, so then developer just types "npm install" and npm gets all needed packages.

Upvotes: 1

Related Questions