1.1.8 • Published 9 years ago

normalize-paths v1.1.8

Weekly downloads
95
License
MIT
Repository
github
Last release
9 years ago

normalize-paths

Use this module to format a path configuration object in order to run it on Unix and Windows systems.

Allows you to write a clean path configuration whilst the plugin will take care of normalizing the paths depending on the OS running the script

Installation

With npm do

npm install normalize-paths --save

How to use it

var normalizePaths = require('normalize-paths');

var assetsFolder = __dirname + '/public/assets';

var paths = {
    srcs: {
        js: __dirname + '/scripts/js',
        sass: __dirname + '/sass'
    },
    dest: {
        js: assetsFolder + '/js',
        css: assetsFolder + '/css'
    }
};

module.exports = normalizePaths(paths);

Output on Unix system:

{
  srcs: {
    js: '/home/taddei/project/scripts/js',
    sass: '/home/taddei/project/sass'
  },
  dest: {
    js: '/home/taddei/project/public/assets/js',
    css: '/home/taddei/project/public/assets/css'
  }
}

Output on Windows system:

{
  srcs: {
    js: 'c:\\Users\\taddei\\project\\scripts\\js',
    sass: 'c:\\Users\\taddei\\project\\project\\sass'
  },
  dest: {
    js: 'c:\\Users\\taddei\\project\\public\\assets\\js',
    css: 'c:\\Users\\taddei\\project\\public\\assets\\css'
  }
}

License

MIT

1.1.8

9 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.4

10 years ago

1.1.2

10 years ago

1.1.0

10 years ago

1.0.4

10 years ago

1.0.2

10 years ago

1.0.0

10 years ago