I would really like to try out a “component”-based approach with Middleman. Is it possible to get Phlex working? I tried to set it up, but got stuck. These were my steps:
- include the
phlex
gem - create a demo component
in components/hello.rb
and an empty class incomponents.rb
- require both from the
config.rb
- render the component with
= render Components::Hello.new
But then I got a contract violation error for the #render
method.
It seems like Middleman’s internal type system kills the interoperability here. Is that correct? Could I simply monkey patch that away for a proof of concept?
Ideally I would like to achive a flat folder structure with all my components in the end:
source/components/
button.rb
button.sass
...
menu.js
menu.rb
menu.sass
Non-component JS and CSS could still remain in the javascripts/
and stylesheets/
folders. Apart from getting Phlex to work at all, that would also require a fair bit of hackery for the autoloading.
Do you think this is doable?