-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please consider adding "partial" functionality to this library #1
Comments
There was a question on StackOverflow asking how to do something like this that I had a go at answering: http://stackoverflow.com/questions/6125265/using-layouts-in-haml-files-independently-of-rails. I’ve created a simple implementation based on this and pushed to a branch: https://github.com/haml/haml-contrib/tree/partials. Have a look and let me know what you think. To use it you’ll need to clone the haml-contrib repo and make sure it’s checked out to the
And inside your Haml file you can use the This will need a bit of polishing up before it’s ready to be merged, in particular I haven’t written any tests. Other issues:
|
@mattwildig I tried it out. It seems to work OK with your instructions. Do you know if it's possible to pass those parameters in apps like CodeKit? |
I don’t know, it will depend on what options CodeKit gives for customising it’s use of Haml. Does it allow adding files to be required before Haml does its thing? Note that you don’t necessarily need the A possible workaround might be to require the partials file in your Haml files themselves: - $:.unshift '/path/to/haml-contrib/lib' unless $:.include? '/path/to/haml-contrib/lib'
- require 'haml/partials' or - require '/path/to/haml-contrib/lib/haml/partials' |
wow 10 months ago, and codekit still doesn't have partials functionality? Its like getting 99% there with 100% being required to match out-side of rails development. |
i'm curious, did somebody got the haml :render working in codekit ? |
I'd really like :php to work in Codekit, but no dice. :/ |
Then try 'middleman', dont know if it supports php but the app is more functional and maintained Verstuurd vanaf mijn iPhone
|
Out of result of the following Twitter conversation, I would like to make a request to add "partial" functionality to the "Haml Contrib" project…
I know Sass and Haml were once from the same library. Sass natively has always had a "partials" feature (or at least that I know), but Haml does not. I have never understood why that is.
I would love to have the opportunity to manage my HAML templates outside of a framework per se. I would like to have my CodeKit (or Terminal), my text editor, my browser and that's it. Why do I need to learn some framework language to manage my Haml templates in a modular and DRY way?
I think it would be a great benefit to add "partial" (or include) functionality to the "Haml Contrib" project. I love writing Haml and managing my templates with it, but would love to start modularizing it (or managing it in chunks). Partials would allow users to utilize DRY principles while managing their Haml markup without having to learn or rely on Rails or Sinatra or any other framework.
I envision it working similar to the way partials work in Sass. Add a file name with underscore preceding the name
_nav.haml
. This file would and could be included but not compiled by the Haml processor to a normal HTML file.Please consider adding "partial" functionality to the "Haml Contrib" project.
Thank you for your consideration!
The text was updated successfully, but these errors were encountered: