A small api to read and write your requirejs config file
npm install requirejs-config-file
var ConfigFile = require('requirejs-config-file').ConfigFile;
// 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: reading and writing the config
var configFile = new ConfigFile('path/to/some/requirejs-config.js'));
var config = configFile.read();
config.baseUrl = '/new';
configFile.write();
// CreateExample: creating a new config file
var configFile = new ConfigFile('path/to/new-config.js'));
configFile.createIfNotExists();
configFile.write();
// 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();