1.0.0 • Published 8 years ago

text-brunch v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

text-brunch

Brunch plugin to read text files as strings in JS.

Install

npm install -D text-brunch

Configuration

By default will work on any .txt file. If you want more, configure it using pattern.

You can configure where the plugin is used using the pattern configuration option. It takes a regular expression or glob or an array of those.

exports.config = {
  plugins: {
    text: {
      pattern: /^fixtures\//
    }
  }
}

Usage

const myTextString = require('./my-file.txt');

If you have JS/TS files with the same base name as your text/other files, and you want to refer to the JS/TS files without their extension, you may want to include this in your config file:

// change the regex to match your pattern if you are using a custom pattern
exports.config = {
  files: {
    javascripts: {
      order: {
        after: [/\.txt$/]
      }
    }
  }
}

This will force your text files to be output later in the file, which means they won't take the alias for the base name.