babel-plugin-transform-liquid-import-to-string

1.0.2 • Public • Published

babel-plugin-transform-liquid-import-to-string

Turn liquid imports (and export from) into strings.

Example

Given the following example.liquid.

<h1>Hello {{ user.name }}</h1>

in

import liquid from './example.liquid';

out

const liquid = '<h1>Hello {{ user.name }}</h1>';

if using export

in

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

out

const liquid = "<h1>Hello {{ user.name }}</h1>";
export { liquid };

and if using vite style qualifiers

in

export * as liquid from './example.liquid?raw';

out

const liquid = "<h1>Hello {{ user.name }}</h1>";
export { liquid };

Installation

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

Usage

Via .babelrc (Recommended)

.babelrc

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

Via CLI

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

Via Node API

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

Package Sidebar

Install

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

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

9.76 kB

Total Files

18

Last publish

Collaborators

  • sarat1669