Skip to content

Instantly share code, notes, and snippets.

@j8seangel
j8seangel / better-nodejs-require-paths.md
Created January 6, 2018 19:48 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

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

@j8seangel
j8seangel / npm-as-build-tool.md
Last active February 4, 2017 11:53
NPM as build tool

Add comments

 "//": "Comments here", (IN THE OBJECT CONFIG)
 # Comment here \n\t (INLINE SCRIPT)

Get the env, path or npm variables

npm run env
npm run env | grep "^PATH"