You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

requirejs-config-file

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requirejs-config-file

A small api to read and write your requirejs config file

3.0.0
Source
npmnpm
Version published
Weekly downloads
1.6M
3.17%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

requirejs

FAQs

Package last updated on 07 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts