4.0.0 • Published 3 years ago

requirejs-config-file v4.0.0

Weekly downloads
193,948
License
MIT
Repository
github
Last release
3 years ago

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();
4.0.0

3 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

6 years ago

2.0.1

7 years ago

2.0.0

10 years ago

1.2.2

10 years ago

1.2.1

11 years ago

1.2.0

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.5

11 years ago

1.0.4

11 years ago

1.0.3

11 years ago

1.0.2

11 years ago

1.0.1

11 years ago