最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - install all grunt devDependencies using one command - Stack Overflow

programmeradmin0浏览0评论

I just setup my Gruntfile.js file and loads all(9) devDependencies. To install these devDependencies, I used following mand

npm install name-of-plugin --save-dev

I used above mand 9 times for each dependency. Now what I want is to install all these dependency using one mand something like grunt install plugins or something else mand. That mand will read devDependencies from package.json file and install it for me.

Is this possible? If yes then how can I achieve this?

I just setup my Gruntfile.js file and loads all(9) devDependencies. To install these devDependencies, I used following mand

npm install name-of-plugin --save-dev

I used above mand 9 times for each dependency. Now what I want is to install all these dependency using one mand something like grunt install plugins or something else mand. That mand will read devDependencies from package.json file and install it for me.

Is this possible? If yes then how can I achieve this?

Share Improve this question asked Apr 13, 2014 at 10:24 Om3gaOm3ga 33.1k45 gold badges149 silver badges230 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

You have to add deveDependencies in package.json and npm install

package.json

{
  "name": "projectname",
  "version": "0.0.1",
  "dependencies": {},

  "devDependencies": {
        "grunt": "~0.4.1",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-contrib-pass": "~0.5.0",
    "grunt-contrib-jshint": "~0.6.0",
    "grunt-contrib-cssmin": "~0.6.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-contrib-imagemin": "~0.2.0",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-contrib-jade": "*",
    "grunt-autoprefixer": "~0.2.0",
    "grunt-usemin": "~0.1.11",
    "grunt-svgmin": "~0.2.0",
    "grunt-rev": "~0.1.0",
    "grunt-concurrent": "~0.3.0",
    "load-grunt-tasks": "~0.1.0"
  }
}

then run

 npm install

if you know your dependencies name then you try like this -

npm install grunt-contrib-sass grunt-contrib-uglify --save
发布评论

评论列表(0)

  1. 暂无评论