lockandload
Lockandload is a minimal AMD-loader-compatible boilerplate to kickstart
your website/single-page-app.
Gzipped, the essential script content amounts to roughly 1KB of code.
Without compression it blows up to just under 2KB. Further minifying this
code does not result in any significant gains, it would just hinder
readability.
Features
- Less filling: 1KB of gzipped script content.
- Handminified to retain readable and maintainable code.
- It's so small, it can and should be inlined on your HTML page
(which is also one of the reasons to handminify it only).
- Fully asynchronous script loader: AMD-compatible.
- Supports anonymous define() calls.
- Supports local require() calls (with one and two arguments).
- Supports implicit and explicit ['require'] dependencies.
- Does not support implicit nor explicit exports/module dependencies.
- Circular dependencies will silently hang in unresolved state.
- No extra diagnostic code to minimise code weight and optimise loading speed.
- Fully event driven, no polling timers.
- Standard event: domready.
- Both high and low priority asynchronous loading of Javascript and CSS files.
- Leverages native browser speed for high priority loading (by getting out
of the way).
- Legacy support for $(...) jquery riddled synchronous code.
- Legacy support for loading synchronous Javascript.
- Single-page-app support using $$(...) page refresh callbacks.
- Supports IE10 and up and all other webbrowsers.
- No config file, means: no syntax to learn, no config file parser code.
Requirements
It runs inside any webbrowser environment (starting at IE10 and up).
Usage
Copy index.html
, main.js
and css/main.css
boilerplate
files to your own new website, and start adjusting them to taste.
The index.html
contains two <script>
sections. The first section
should not be placed earlier or later in the page than it currently is.
The second section must be placed at or close to the end of the <head>
,
and should not precede any direct <link type="stylesheet">
tags.
API
References
Other loaders: