LowLoad is really dumb; like a bull in a china shop, smashing through fragile dependencies to autoload your code without manual load/require/require_relative calls.
- First LowLoad goes through all your files and notes their constant definitions and file paths
- Then it goes through the same files again and creates autoloads for each file's dependencies
- Then it goes through every file again and loads it into Ruby
Features:
- Use any namespace structure you want (namespaces are not inferred from folder structure)
- Mix in manual requires in autoloaded files
- Supports RBX files
LowLoad supports normal Ruby (.rb) files as well as a few other embedded formats.
LowLoad supports loading RBX files (.rbx). RBX files are Ruby files containing unescaped HTML markup:
class MyClass
def render
<p>Hello</p>
end
endℹ️ For more information see LowNode.
Antlers syntax such as <{ ChildNode }> can be embedded inside the render method of your RBX file.
- Folders are often organised by the kind of file it is, a bunch of views for example. But namespaces should be organised by your domain — different to your file structure
- You should be able to mix autoloading with manual
requirecalls for stuff like gems, andrequire_relativewhen you need files outside the autoloaded directory
Like other autoloading libraries, LowLoad doesn't support circular dependencies on class load (runtime is fine).
❌ Please don't do:
class A
include B
end
class B
include A
end✅ Instead do:
class A
include C
end
class B
include C
end
class C
# Code that both A and B share.
endAdd gem 'lowload' to your Gemfile then:
bundle install