Michael Joseph Aubry
Michael Joseph Aubry

Reputation: 13402

Should gulp.js plugins be inside package.json?

So far in my build I haven't had a need for using package.json, since I been downloading each plugin for gulp directly ex npm install gulp-jshint (gulp plugins were the only node modules I was using, now I have a need for node to use express(and more), express says they should be inside package.json). However I have been using a bower.json file to get project packages like jquery and backbone etc.

So from my understanding package.json works kind of like the bower.json except it's used mainly for node modules/plugins, is that correct?

Id like to know if the above is correct, that kind of helps lead into this next question. Should I include all the gulpjs plugins inside the "dependencies"? Were the tutorials kind of a quick dirty way of explaining how to get the gulpjs plugins, it feels like those plugins should be inside a package.json, right?

Edit: So looking at this boilerplate it looks like they include gruntjs plugins

{
  "name": "",
  "description": "",
  "version": "0.0.0",
  "private": true,
  "author": "Brian Frichette",
  "homepage": "",
  "contributors": [ "Brian Frichette <[email protected]> (https://github.com/brian-frichette)" ],
  "bugs": { "url": "" },
  "scripts": { "start": "nodemon app.js" },
  "dependencies": {
    "express": "3.x",
    "jade": "*",
    "less-middleware": "*",
    "lodash": "1.x"
  },
  "devDependencies": {
    "grunt": "0.4.x",
    "karma": ">=0.8",
    "grunt-contrib-uglify": ">=0.2",
    "grunt-contrib-concat": ">=0.1.3",
    "grunt-contrib-watch": ">=0.3",
    "grunt-contrib-jshint": ">=0.3",
    "grunt-contrib-coffee": ">=0.6",
    "async": "0.1.x",
    "nodemon": "*"
  },
  "keywords": [],
  "repository": "",
  "licenses": [{
    "type": "MIT",
    "url": "http://opensource.org/licenses/MIT"
  }]
}

Upvotes: 1

Views: 2235

Answers (1)

Cory Danielson
Cory Danielson

Reputation: 14501

So from my understanding package.json works kind of like the bower.json except it's used mainly for node modules/plugins, is that correct?

Yes. Bower.js is for front-end dependencies and node.js would be for your server/development dependencies.


When you install your gulp dependencies you should use the --save-dev flag so that they're installed in your package.json under the devDependencies section (it will be created).

npm install gulp-jshint --save-dev

Upvotes: 6

Related Questions