Skip to content

easesu/rollup-plugin-html-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rollup-plugin-html-input

Rollup plugin to use HTML files as input.

Installation

npm install --save-dev rollup-plugin-html-input

Usage

// rollup.config.js
const htmlPlugin = require('rollup-plugin-html-input');

module.exports = {
    input: 'index.html',
    output: {
        format: 'iife',
        dir: './dist'
    }
    plugins: [
        htmlPlugin()
    ]
}

Demo

source

index.html

<!DOCTYPE html>
<html>
<head>
    <title>Index</title>
</head>
<body>
    <script>
        console.log("from inline script");
    </script>
    <script src="./external.js"></script>
</body>
</html>

external.js

console.log("from external script");

rollup config

rollup.config.js

const htmlPlugin = require('rollup-plugin-html-input');

module.exports = {
    input: 'index.html',
    output: {
        format: 'iife',
        dir: './dist'
    }
    plugins: [
        htmlPlugin()
    ]
}

output

index.html

<!DOCTYPE html>
<html>
<head>
    <title>Index</title>
</head>
<body>
<script>(function () {
    'use strict';

    console.log("from inline script");

    console.log("from external script");

}());
</script></body>
</html>

About

Rollup plugin to use HTML files as input

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published