Skip to content

Instantly share code, notes, and snippets.

@mrself
mrself / gulpfile.js
Last active August 29, 2015 14:20 — forked from ktmud/gulpfile.js
var BatchStream = require('batch-stream2')
var gulp = require('gulp')
var coffee = require('gulp-coffee')
var uglify = require('gulp-uglify')
var cssmin = require('gulp-minify-css')
var bower = require('gulp-bower-files')
var stylus = require('gulp-stylus')
var livereload = require('gulp-livereload')
var include = require('gulp-include')
var concat = require('gulp-concat')

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

.wrapper{
width: 550px;
text-align: justify;
background: firebrick;
font-size: 0;
font-size: 12px\9; /* IE6-9 only hack */
}
.wrapper div{
background: white;