rawquire

0.0.1 • Public • Published

rawquire for babel

Import raw plaintext.

Install with npm:

$ npm install babel-plugin-macros --save-dev
$ npm install rawquire --save-dev

Add "macros" to your .babelrc, or preferred babel config:

{
	"plugins": ["macros"]
}

Import raw text into your javascript:

Call rawquire with a file path relative to the current script in the source tree.

Any rawquire function calls will be replaced with a string literal containing the text from the file.

Source code:

hello-world.js:

import { rawquire } from 'rawquire/rawquire.macro';

const myHtml = rawquire('./hello-world.html');

hello-world.html:

<h1>Hello, world!</h1>

Compiled code:

hello-world.js:

const myHtml = "<h1>Hello, world!</h1>";

Readme

Keywords

Package Sidebar

Install

npm i rawquire

Weekly Downloads

1

Version

0.0.1

License

Apache-2.0

Unpacked Size

11.7 kB

Total Files

5

Last publish

Collaborators

  • seanmorris