🔥 Parcel plugin that enables bundling of Google App Script HTML.
If you've ever developed an add-on for Google's Office Suite with Google Apps Script,
then you'll know how inefficient it is to develop your add-on's UI.
This is because Google's Apps Script supports only .gs and .html files.
If you want to use CSS and JS, the only option is to create an HTML file and wrap
your CSS code inside
<style> tag or your JS inside
<script> tag and include
it in your UI using scriptlets.
This approach has serious flaws.
Parcel (nor any other modern JS bundler for that matter), doesn't recognize scriptlets
Because of this, it won't apply any code transformation to those files and won't bundle them.
Why is this approach bad?
- 🚫 CSS not prefixed (The UI breaks on some browsers)
- 🚫 JS not transpiled (Usage of modern JS not possible)
- 🚫 Code can't be split in modules
- 💣 Large file sizes (Code not minified)
# Installs the plugin and saves it as a development dependencynpm i parcel-plugin-gas-imports -D
The plugin allows you to include your JS and CSS just like you would normally do it in HTML:
# Example add-on UI filessrc├── index.html├── style.css└── script.js
DocumentGoogle Apps Script Sidebar
parcel build src/index.html
# Fully optimized project ready for deploymentdist├── index.html├── style.e308ff8e.css.html└── script.75da7f30.js.html
ℹ️ NOTE: If you want to prevent this plugin from running in certain cases you can set
✨ Run tests
The plugin uses Jest for running tests.
Jest will execute all
.test.js files in the
Contributions, issues and feature requests are welcome!
This project is licensed under MIT license.
👨🚀 Show your support
Give a ⭐️ if this project helped you!