rollup-plugin-script-tag
A rollup plugin that will bundle javascript from within <script>
tags. Treat files that contain <script></script>
tags as modules by importing them into your bundle.
Installation
npm install --save-dev rollup-plugin-script-tag
Usage
// rollup.config.js input: 'bundle.js' plugins: // Load first, before any other plugins
// bundle.js
<!-- example.html -->
Options
There a 2 options that can be applied
Extensions
The extensions
accepts an array. The extensions option will allow you to parse and accept different file extensions that contain <script>
tags. There are several common extensions that are included by default, they are:
- .erb
- .handlebars
- .hbs
- .htm
- .html
- .liquid
- .mustache
- .nunjucks
- .php
- .tag
- .twig
- .we
Please Note:
Defining new extensions will overwrite all defaults, create a PR if you would like default extensions to be included.
Exclude
The exclude
options accepts an array. The exclude options allows you to skip parsing imports. This is helpful if you're using another rollup plugin like rollup-plugin-html.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Contributions and feedback are very welcome.
To get it running:
- Clone the project.
npm install
npm run build
License
The MIT License (MIT). Please see License File for more information.