Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.
/ raw-brunch Public archive

A Brunch plugins for raw modules

License

Notifications You must be signed in to change notification settings

denysdovhan/raw-brunch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raw-brunch

NPM version Build Status Dependency Status

A Brunch plugins for raw modules

This plugin is needed for requiring raw data in your JavaScript files, like Markdown or just plain text files.

Install

npm install --save-dev raw-brunch

Usage

raw-brunch handles files with raw, plain and example extensions as templates:

module.exports = {
  files: {
    // ...
    templates: {joinTo: 'templates.js'}
  }
}

Content of these files will be bundled as plain strings into templates.js file, so you can require them in your files.

Options

raw-brunch has two simple options:

  1. pattern — a pattern that matches files (raw, plain, example files as default).
  2. wrapper — a function that wraps the content of a file.
module.exports = {
  // ...
  plugins: {
    raw: {
      pattern: /\.(raw|plain|example)$/,
      wrapper: content => `module.exports = ${JSON.stringify(content)}`
    }
  }
}

License

MIT © Denys Dovhan