Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-html-insert

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-html-insert

rollup plugin to edit html template

  • 1.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

rollup-plugin-html-insert

🍣 A Rollup plugin which creates HTML files to serve Rollup bundles. The default function is to package all html css js in one html file. The usage scenario is mainly used for demo development. There is no need to load resources through 'src'. All the code is in html file, which is convenient for sending and deployment.

Localized plugin docs

  • 简体中文 (by @wenjayliu)

Install

Using pnpm:

pnpm add -D rollup-plugin-html-insert

Usage

Create a rollup.config.js configuration file and import the plugin:

import htmlInsert from 'rollup-plugin-html-insert'

export default {
  input: 'src/main.js',
  output: {
    dir: 'output',
    format: 'iife'
  },
  plugins: [htmlInsert()]
}

Default package output

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>test</title>
  </head>

  <body>
    <div id="app"></div>
    <!-- built files will be auto injected -->
    <script id="main">
      ;(function () {
        // JavaScript bundle code ...
      })()
    </script>
  </body>
</html>

options

template

Specifies a String that provides the rendered source for the HTML file. The function should be in the form of:

Type: String
example: htmlInsert({ template: 'index.html'})
default: './public/index.html'

insert

Insert path or code:

Type: String
example: htmlInsert({ insert: 'path'})
default: 'code'

entryFileNames

the output file name.

Type: String
example: htmlInsert({ entryFileNames: 'index.html'})
default: 'index.html'

publicPath

Specifies a path to prepend to all bundle assets (files) in the HTML output.

Type: String
example: htmlInsert({ publicPath: './'})
default: './'

Keywords

FAQs

Package last updated on 06 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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