Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brokeboiflex/barba-head
https://github.com/brokeboiflex/barba-head
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/brokeboiflex/barba-head
- Owner: brokeboiflex
- Created: 2024-11-30T20:19:20.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2024-11-30T20:29:23.000Z (about 1 month ago)
- Last Synced: 2024-11-30T21:23:12.377Z (about 1 month ago)
- Language: HTML
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Caution!
This repo contains a minimal implementation of a non existing barba-head plugin workaround. It's meant to be hacked to fit your needs. I'm not affiliated with barba nor its creator.
It will break all scripts depending on `DOMContentLoaded` event bc it already fired so You'll have to use a workaround like this:
```js
function deferScriptExecution() {
console.log("defering");if (document.readyState === "loading") {
console.log("loading");
//
document.addEventListener("DOMContentLoaded", init);
} else {
console.log("ready");// Main function
init();
}
}
deferScriptExecution();
```It will also remove every element from head that doesn't have the `data-critical` attribute.
# Build for static
Originally I used it to make WordPress page faster
`npm run build` will build a script usable with static sites. Just include it in your head with `data-critical` attribute.