Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-html-import-require-to-string - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "babel-plugin-transform-html-import-require-to-string",
"version": "0.0.2",
"version": "0.0.3",
"description": "Turn HTML imports and requires into string vars",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -1,3 +0,50 @@

#babel-plugin-transform-html-import-require-to-string
# babel-plugin-transform-html-import-require-to-string
Inspired by https://github.com/yeiniel/babel-plugin-transform-html-import-to-string
Turn HTML imports and requires into string vars. Make your transpiled code as verbose as this package name!
Inspired by https://github.com/yeiniel/babel-plugin-transform-html-import-to-string
## Example
Given a file `assets/template.html`
```
<h1>Hello</h1>
```
Transform your imports
```
import template from "/assets/template.html"
const requiredTemplate = require("/assets/template.html)
```
to
```
var template = "<h1>Hello</h1>"
const requiredTemplate = "<h1>Hello</h1>"
```
## Installation
Install with your package manager of choice
```
yarn add babel-plugin-transform-html-import-require-to-string
```
Then use as per usual...
### Via `.babelrc`
```
{
"plugins": ["transform-html-import-require-to-string"]
}
```
### Via CLI
```
$ babel --plugins transform-html-import-require-to-string script
```
### Via Node API
```
require("babel-core").transform("code", {
plugins: ["transform-html-import-require-to-string"]
});
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc