Skip to content
Rollup plugin that inliing fs.readFile contents.
TypeScript JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src init Jul 6, 2019
test init Jul 6, 2019
.gitignore init Jul 6, 2019
.travis.yml init Jul 6, 2019
LICENSE init Jul 6, 2019
README.md Add Known Problems Jul 6, 2019
package.json 1.0.1 Jul 6, 2019
tsconfig.json init Jul 6, 2019
yarn.lock init Jul 6, 2019

README.md

rollup-plugin-brfs Build Status

Rollup plugin that inliing fs.readFile contents.

This plugin use browserify/brfs. It supports that

  • fs.readFileSync(pathExpr, enc=null)
  • fs.readFile(pathExpr, enc=null, cb)
  • fs.readdirSync(pathExpr)
  • fs.readdir(pathExpr, cb)

Known Problems

browserify/brfs does not support ES module.

import fs from "fs";
const text = fs.readFileSync(__dirname + "/readme.md", "utf-8");
console.log(text);

It does not inlined.

If you used babel, babel-plugin-static-fs will resolve it.

Install

Install with npm:

npm install rollup-plugin-brfs

Usage

// rollup.config.js
import brfs from 'rollup-plugin-brfs';

export default {
  input: 'src/main.js',
  output: {
    file: 'dist/bundle.js',
    format: 'iife'
  },

  plugins: [
    brfs()
  ]
};

Options

export type rollupBrfsOptions = {
    // Default:  [".js", ".jsx", ".ts", ".tsx"]
    extensions?: string[]
    // https://github.com/browserify/brfs#var-tr--brfsfile-opts
    brfsOptions?: {}
}

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

You can’t perform that action at this time.