BKWLD / laravel-haml

Wraps MtHaml for ease use in Laravel
MIT License
45 stars 10 forks source link

Add layout and section support #10

Closed gillesmk closed 10 years ago

gillesmk commented 10 years ago

Based on blade Templating system I had the support of layout / include / yield feature. calling a php function with the view_ prefix will do it's equivalent in blade. All Blade @ prefixed function are supported appart from stuff like test and loop (eg. @for, @foreach)

View


- view_extends("layout")

- view_section("content")
%p
Lorem ipsum dolor sit amet, consectetur adipiscing 
- view_stop()

Layout

%html
  %head
  %body
    %h1 Hi
    .content
      - view_yield("content")
weotch commented 10 years ago

I'd prefer to keep the basic HamlCompiler class more generic. What if you subclassed it with a new BladeHamlCompiler class that adds your new logic (which looks sound, thanks for all the comments and organization)? Then, in the service provider, you add a new addExtension call that looks for files that end in 'blade.haml.php', 'blade.haml', 'haml.blade', and 'haml.blade.php' and uses your new BladeHamlCompiler class to resolve the view, instead of the basic HamlCompiler.

gillesmk commented 10 years ago

Yes sure it sounds more logical.

I’ll work on something more haml friendly. Using indention to get section blocks rather than having view_section and view_stop. I’ll do an extension of yours in separate repo.

Thanks for feedback and for the library

m k

Gilles Boisson Web Developer Manythink Office: +32 2 559 01 64 Fax: +32 2 527 57 59 55 rue des Anciens Étangs B-1190 Brussels gilles@manythink.be (mailto:remy@manythink.be) www.manythink.be (http://www.manythink.be)

Le lundi 30 juin 2014 à 18:22, Robert Reinhard a écrit :

I'd prefer to keep the basic HamlCompiler class more generic. What if you subclassed it with a new BladeHamlCompiler class that adds your new logic (which looks sound, thanks for all the comments and organization). Then, in the service provider, you add a new addExtension call that looks for files that end in 'blade.haml.php', 'blade.haml', 'haml.blade', and 'haml.blade.php' and uses the new BladeHamlCompilerclass to resolve the view, instead of the basic HamlCompiler.

— Reply to this email directly or view it on GitHub (https://github.com/BKWLD/laravel-haml/pull/10#issuecomment-47552714).

weotch commented 10 years ago

Cool. I'll close this for now until those changes are ready.