work.suroh.tk/node_modules/requirejs-config-file
suroh 410082595a init 11ty commit 2019-12-02 13:22:45 +01:00
..
.idea init 11ty commit 2019-12-02 13:22:45 +01:00
files/fixtures init 11ty commit 2019-12-02 13:22:45 +01:00
test init 11ty commit 2019-12-02 13:22:45 +01:00
.jshintrc init 11ty commit 2019-12-02 13:22:45 +01:00
.rmt.yml init 11ty commit 2019-12-02 13:22:45 +01:00
.travis.yml init 11ty commit 2019-12-02 13:22:45 +01:00
CHANGELOG init 11ty commit 2019-12-02 13:22:45 +01:00
Gruntfile.js init 11ty commit 2019-12-02 13:22:45 +01:00
LICENSE init 11ty commit 2019-12-02 13:22:45 +01:00
README.md init 11ty commit 2019-12-02 13:22:45 +01:00
index.js init 11ty commit 2019-12-02 13:22:45 +01:00
package.json init 11ty commit 2019-12-02 13:22:45 +01:00

README.md

requirejs-config-file Build Status

NPM

A small api to read and write your requirejs config file

installation

npm install requirejs-config-file

usage

require the constructor

var ConfigFile = require('requirejs-config-file').ConfigFile;

read

// Read: reading the config
var configFile = new ConfigFile('path/to/some/requirejs-config.js'));

var config = configFile.read();

console.log(config); // is an object with the found config

modify (read and write)

// Modify: reading and writing the config
var configFile = new ConfigFile('path/to/some/requirejs-config.js'));

var config = configFile.read();

config.baseUrl = '/new';

configFile.write();

create

// CreateExample: creating a new config file
var configFile = new ConfigFile('path/to/new-config.js'));

configFile.createIfNotExists();

configFile.write();

create or modify

// CreateAndModifyExample: reading and writing a maybe not existing config file
var configFile = new ConfigFile('path/to/new-config.js'));

configFile.createIfNotExists();

configFile.read();

config.baseUrl = '/new';

configFile.write();