Category Archives: NodeJS

Gulp – Rewrite source files instead of creating new files

I would like to minified the .js files of the bower packages in my project. Usually, gulp will read the source files and the pipe them into new files but this time i would like to overwrite the original file without creating a .min.js file.

Example:

gulp.task('jsmin', function() {
  return gulp.src('bower_components/**/*.js', {base: './'})
    .pipe(sourcemaps.init())
      .pipe(uglify())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./'));
});

 

The above task will read those .js files inside the bower_components folder, uglify the source file and create the corresponding .map file for each .js file in the same folder.

Done =)

Reference: StackOverflow – Can Gulp overwrite all src files?

Advertisement

Ubuntu – Install Node Ver­sion Man­ager globally for all users

The Node Ver­sion Man­ager(nvm) could help you to manage multiple Node.js installations. The following steps are executed from root account.

1. Install the required packages.

apt-get install build-essential openssl libssl-dev curl

 

2. Create a new user group and add those users which are allowed to manage Node.js installation. The following command create a new group called dev.

groupadd dev

Continue reading Ubuntu – Install Node Ver­sion Man­ager globally for all users