Maybe something like the following would be possible?
%Layout::Section
%Layout::Heading(level=1) Hello world
I'm thinking a new module system would be nice, something like this:
App = ModuleSystem.new(File.join(__dir__, "app"))
# The following will resolve app/Components/Button.haml
App::Components::Button.haml
And inside app/Components/Button.haml, the constant M would refer to the current module.
:ruby
# Get something from app/Components/Button.css
M.css.class_names
%button
%slot
= if $icon
-# This will get app/Components/Icon
%M::Parent::Icon(name=$icon)
= if $icon
-# This will get app/Components/Icon
%App::Components::Icon(name=$icon)
Or maybe cleaner to specify the full path always...
:ruby
Icon = App::Components::Icon
%button
%slot
= if $icon
%Icon(name=$icon)
Anyways, I think this way, it would be possible to generate type information for modules. And marshalling should work for classes defined inside components because all modules would have names.
Instead of requiring every component in the beginning of the file like this:
Maybe something like the following would be possible?
I'm thinking a new module system would be nice, something like this:
And inside
app/Components/Button.haml
, the constantM
would refer to the current module.Or maybe cleaner to specify the full path always...
Anyways, I think this way, it would be possible to generate type information for modules. And marshalling should work for classes defined inside components because all modules would have names.