Node Package Manager

 

"APT" for Ubuntu

 

 "Composer" for PHP

 

"RubyGem" for Ruby

 

"NuGet" for C#

 

also Sublime, WebStorm, Atom & etc...

 

Use it!

 

npm install

 

npm uninstall

 

npm update

 

npm init

 

How npm works

 

package.json

 
{
  "name": "my_package",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Egor",
  "license": "ISC",
  "repository": {
    "type": "git",
    "url": "https://github.com/egor/my_package.git"
  },
  "bugs": {
    "url": "https://github.com/egor/my_package/issues"
  },
  "homepage": "https://github.com/egor/my_package"
}
{
  "name": "my_package",
  "version": "1.0.0",
  "dependencies": {
    "my_dep": "^1.0.0"
  },
  "dependencies" : {
    "framework": "^3.1.0"
  },
  "devDependencies" : {
    "my_test_framework": "^3.1.0"
  }
}

Gulp, Grunt && NPM

 

Gulp

 

$ npm install --global gulp-cli

$ npm install --save gulp

$ npm install --save gulp-less

 
//into gulpfile.js

var gulp = require('gulp');
var less = require('gulp-less');
var path = require('path');

gulp.task('less', function () {
  return gulp.src('./less/index.less')
    .pipe(less({
      // do smth
    }))
    .pipe(gulp.dest('./public/css'));
});

$ gulp less

 
{
  "name": "test-gulp-project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^3.9.0",
    "gulp-less": "^3.0.5"
  }
}

NPM

 

$ npm install less --save

 
{
  "name": "test-gulp-project",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "less": "lessc ./less/index.less ./public/css/index.css",
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "less": "^2.6.0"
  }
}

$ npm run less

 
Made with Slides.com