babel-plugin-transform-html-import-to-string

2.0.0 • Public • Published

babel-plugin-transform-html-import-to-string

Build Status

Turn HTML imports (and export from) into strings.

Example

Given the following example.html.

<h1>Hello</h1>

in

import html from './example.html';

out

const html = '<h1>Hello</h1>';

and if using export

in

export * as html from './example.html';

out

const html = "<h1>Hello</h1>";
export { html };

Installation

$ npm install babel-plugin-transform-html-import-to-string

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-html-import-to-string"]
}

Via CLI

$ babel --plugins transform-html-import-to-string script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-html-import-to-string"]
});

/babel-plugin-transform-html-import-to-string/

    Package Sidebar

    Install

    npm i babel-plugin-transform-html-import-to-string

    Weekly Downloads

    8,749

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    8.81 kB

    Total Files

    15

    Last publish

    Collaborators

    • yeiniel