msimmer / inline-require

A utility to replace require'd files with the files' contents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inline-require

Replace require'd files with the files' contents

npm version Build Status Coverage Status

Inline dependencies from required modules. Can be used as a module using require or on the CLI.

Install

$ yarn add inline-require

Usage

// my-dependency.js
module.exports = { foo: 'bar' }
// index.js
const myDependency = require('./my-dependency')
// build.js
const inliner = require('inline-require')

inliner('./index.js', (err, data) => {
    if (err) { throw err }
    console.log(data) // => const myDependency = { foo: 'bar' }
})

CLI

$ node ./inliner ./index.js # prints to stdout

About

A utility to replace require'd files with the files' contents

License:ISC License


Languages

Language:JavaScript 100.0%