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

Provide support for HAML and SASS #53

Closed
imanel opened this Issue Jun 1, 2009 · 32 comments

Comments

Projects
None yet
@imanel

imanel commented Jun 1, 2009

More and more people uses HAML and SASS from nex, so I think it will be good thing to implement it in Jekyll. http://github.com/henrik/jekyll/tree/master have it already in his tree, but it's old and unsuported version of Jekyll. So will it be a problem to pull this functions from his repo? If there's some code-blokers I will willingly help with enhance code.

@qrush

This comment has been minimized.

Show comment
Hide comment
@qrush

qrush Jun 1, 2009

Contributor

The problem is that GitHub pages cannot allow people to execute arbitrary Ruby code. In other tickets I've mentioned that the best way to do this is to have a 'secure' mode for Pages and a non-secure mode that is more flexible. I haven't seen this implemented cleanly anywhere that I can merge into the core yet.

Contributor

qrush commented Jun 1, 2009

The problem is that GitHub pages cannot allow people to execute arbitrary Ruby code. In other tickets I've mentioned that the best way to do this is to have a 'secure' mode for Pages and a non-secure mode that is more flexible. I haven't seen this implemented cleanly anywhere that I can merge into the core yet.

@imanel

This comment has been minimized.

Show comment
Hide comment
@imanel

imanel Jun 1, 2009

I'm sorry, but still don't understand - what have Jekyll implementation to do with GitHub pages?

imanel commented Jun 1, 2009

I'm sorry, but still don't understand - what have Jekyll implementation to do with GitHub pages?

@henrik

This comment has been minimized.

Show comment
Hide comment
@henrik

henrik Jun 1, 2009

Contributor

imanel, Jekyll is used for GitHub pages. My version of Jekyll wasn't forked that long ago, and has been updated once or twice since, but my additions don't come with tests.

Secure/insecure could be interesting.

Contributor

henrik commented Jun 1, 2009

imanel, Jekyll is used for GitHub pages. My version of Jekyll wasn't forked that long ago, and has been updated once or twice since, but my additions don't come with tests.

Secure/insecure could be interesting.

@imanel

This comment has been minimized.

Show comment
Hide comment
@imanel

imanel Jun 1, 2009

Sorry - didn't know:/
About secure/insecure mode - there's another way. At this time Jekyll have 167 forks - mostly adding one or two small functions, sometimes something more. What if you could add lib directory and put into your application any plugins you want? http://github.com/tomash/jekyll/tree/per-site-libfiles have something like that - in standard it's normal Jekyll, but You can provide --plugins option so everything in _lib will be executed. GitHub will run without this option, but users will be able to create Jekyll-ecosystem of plugins instead of useless(sorry) forks... How about that solution?

PS: @henrik - don't know how I did that, but I was sure that your last update was 8.04 ;) Anyway - is there any chance to update to newest version soon?

imanel commented Jun 1, 2009

Sorry - didn't know:/
About secure/insecure mode - there's another way. At this time Jekyll have 167 forks - mostly adding one or two small functions, sometimes something more. What if you could add lib directory and put into your application any plugins you want? http://github.com/tomash/jekyll/tree/per-site-libfiles have something like that - in standard it's normal Jekyll, but You can provide --plugins option so everything in _lib will be executed. GitHub will run without this option, but users will be able to create Jekyll-ecosystem of plugins instead of useless(sorry) forks... How about that solution?

PS: @henrik - don't know how I did that, but I was sure that your last update was 8.04 ;) Anyway - is there any chance to update to newest version soon?

@henrik

This comment has been minimized.

Show comment
Hide comment
@henrik

henrik Jun 1, 2009

Contributor

Jekyll is small and hackable enough that I think I prefer forking and modifying to a lib/plugin solution. It's definitely tricky to figure out what fork to use, or if someone has already added functionality you want, but we could perhaps use the wiki to make that easier. http://wiki.github.com/mojombo/jekyll/sites does that to some extent.

As to my fork, feel free to fork that and update to latest Jekyll ;) I might do that next time I hack on it, but that may not be for a while.

Contributor

henrik commented Jun 1, 2009

Jekyll is small and hackable enough that I think I prefer forking and modifying to a lib/plugin solution. It's definitely tricky to figure out what fork to use, or if someone has already added functionality you want, but we could perhaps use the wiki to make that easier. http://wiki.github.com/mojombo/jekyll/sites does that to some extent.

As to my fork, feel free to fork that and update to latest Jekyll ;) I might do that next time I hack on it, but that may not be for a while.

@tomash

This comment has been minimized.

Show comment
Hide comment
@tomash

tomash Jun 2, 2009

Contributor

+1 for Haml and Sass.

I don't accept the security argument here. The point being here is to use Haml as markup generator, not templating engine for replacing Liquid.

So maybe the point/aim is: have/get/make a Haml parser that ignores "-" and "=" ruby code blocks (just a dumb html generator) and make it work with Liquid. That would be secure enough and at the same time let us be freed from HTML when writing our pages -- I mean, come on, it's 2009 ;)

Contributor

tomash commented Jun 2, 2009

+1 for Haml and Sass.

I don't accept the security argument here. The point being here is to use Haml as markup generator, not templating engine for replacing Liquid.

So maybe the point/aim is: have/get/make a Haml parser that ignores "-" and "=" ruby code blocks (just a dumb html generator) and make it work with Liquid. That would be secure enough and at the same time let us be freed from HTML when writing our pages -- I mean, come on, it's 2009 ;)

@tomash

This comment has been minimized.

Show comment
Hide comment
@tomash

tomash Jun 2, 2009

Contributor

Like, here:
http://lab.hamptoncatlin.com/play/with/haml

Try putting (for instance) {{ liquid stuff }} somewhere in the source haml and generate.

And from HAML documentation (options for rendering engine):
…or by passing an options hash to Haml::Engine.new. Available options are:

:format
Determines the output format. The default is :xhtml. Other options are :html4 and :html5, which are identical to :xhtml except there are no self-closing tags, XML prolog is ignored and correct DOCTYPEs are generated.
:escape_html
Sets whether or not to escape HTML-sensitive characters in script. If this is true, = behaves like &=; otherwise, it behaves like !=. Note that if this is set, != should be used for yielding to subtemplates and rendering partials. Defaults to false.
:suppress_eval
Whether or not attribute hashes and Ruby scripts designated by = or ~ should be evaluated. If this is true, said scripts are rendered as empty strings. Defaults to false.

How many internets do I win? ;)

Contributor

tomash commented Jun 2, 2009

Like, here:
http://lab.hamptoncatlin.com/play/with/haml

Try putting (for instance) {{ liquid stuff }} somewhere in the source haml and generate.

And from HAML documentation (options for rendering engine):
…or by passing an options hash to Haml::Engine.new. Available options are:

:format
Determines the output format. The default is :xhtml. Other options are :html4 and :html5, which are identical to :xhtml except there are no self-closing tags, XML prolog is ignored and correct DOCTYPEs are generated.
:escape_html
Sets whether or not to escape HTML-sensitive characters in script. If this is true, = behaves like &=; otherwise, it behaves like !=. Note that if this is set, != should be used for yielding to subtemplates and rendering partials. Defaults to false.
:suppress_eval
Whether or not attribute hashes and Ruby scripts designated by = or ~ should be evaluated. If this is true, said scripts are rendered as empty strings. Defaults to false.

How many internets do I win? ;)

@bmaland

This comment has been minimized.

Show comment
Hide comment
@bmaland

bmaland Jun 3, 2009

Contributor

After my Engine related refactoring (Chrononaut@dc70e3ba033752f6925fb402542bb647d829a172), adding Haml engine support was just a few lines of code away (I guess this proves that the refactoring was useful). The Haml engine implementation can be viewed here: Chrononaut@2dc41d1ccc6dde853db9fe9463718c67e0dded1a. The test shows that the Ruby evaled code indeed is suppressed.

I think that at least the refactor commit should be pulled in - it makes the Site class a lot cleaner.

It is already really easy to use compass with Jekyll for Sass, as described in my short blog post (http://chrononaut.net/2009/05/08/using-compass-with-jekyll.html). Simply let compass automatically compile the Sass locally, no additional support from Jekyll is required.

Contributor

bmaland commented Jun 3, 2009

After my Engine related refactoring (Chrononaut@dc70e3ba033752f6925fb402542bb647d829a172), adding Haml engine support was just a few lines of code away (I guess this proves that the refactoring was useful). The Haml engine implementation can be viewed here: Chrononaut@2dc41d1ccc6dde853db9fe9463718c67e0dded1a. The test shows that the Ruby evaled code indeed is suppressed.

I think that at least the refactor commit should be pulled in - it makes the Site class a lot cleaner.

It is already really easy to use compass with Jekyll for Sass, as described in my short blog post (http://chrononaut.net/2009/05/08/using-compass-with-jekyll.html). Simply let compass automatically compile the Sass locally, no additional support from Jekyll is required.

@tomash

This comment has been minimized.

Show comment
Hide comment
@tomash

tomash Jun 3, 2009

Contributor

+1 for Chrononaut commits

Contributor

tomash commented Jun 3, 2009

+1 for Chrononaut commits

@henrik

This comment has been minimized.

Show comment
Hide comment
@henrik

henrik Jun 3, 2009

Contributor

Chrononaut, that looks like a nice refactoring. How does it handle access to site etc from e.g. Haml templates? From a quick look at the code, it's not handled. What I did was render in a context and use a custom class similar to OpenStruct for that context:

http://github.com/henrik/jekyll/commit/b9dea95f1ed100d5786d3cb580fcab968ab3b41f

http://github.com/henrik/jekyll/commit/8870dde625e850c2b173ed97d30de5d34e8ec61b

Contributor

henrik commented Jun 3, 2009

Chrononaut, that looks like a nice refactoring. How does it handle access to site etc from e.g. Haml templates? From a quick look at the code, it's not handled. What I did was render in a context and use a custom class similar to OpenStruct for that context:

http://github.com/henrik/jekyll/commit/b9dea95f1ed100d5786d3cb580fcab968ab3b41f

http://github.com/henrik/jekyll/commit/8870dde625e850c2b173ed97d30de5d34e8ec61b

@bmaland

This comment has been minimized.

Show comment
Hide comment
@bmaland

bmaland Jun 3, 2009

Contributor

Actually, accessing site data isn't a problem, just use Liquid tags. I had to add one line to convertible.rb to make Jekyll support Haml layouts: Chrononaut@1baf081c389f22d52ef422cbc2ec12697bb72173

I've converted my own layouts to Haml, one example can be viewed here: http://github.com/Chrononaut/chrononaut.net/blob/d919c7428b6dc1eab054a4dc79125346fd046b01/index.haml . Works just fine.

Liquid tags works for Haml posts/pages as well as layouts. By using Liquid everything should be just as safe as before since no Ruby evals are done from the Haml templates. So this shouldn't be a problem to run on GitHub pages.

Contributor

bmaland commented Jun 3, 2009

Actually, accessing site data isn't a problem, just use Liquid tags. I had to add one line to convertible.rb to make Jekyll support Haml layouts: Chrononaut@1baf081c389f22d52ef422cbc2ec12697bb72173

I've converted my own layouts to Haml, one example can be viewed here: http://github.com/Chrononaut/chrononaut.net/blob/d919c7428b6dc1eab054a4dc79125346fd046b01/index.haml . Works just fine.

Liquid tags works for Haml posts/pages as well as layouts. By using Liquid everything should be just as safe as before since no Ruby evals are done from the Haml templates. So this shouldn't be a problem to run on GitHub pages.

@henrik

This comment has been minimized.

Show comment
Hide comment
@henrik

henrik Jun 4, 2009

Contributor

Chrononaut: Ah, get it, thanks.

In my fork, I'm moving towards removing Liquid entirely and only using Haml, without suppressing eval, since I got frustrated working within the Liquid limitations. But this is for running on my own server, not as GitHub Pages.

Contributor

henrik commented Jun 4, 2009

Chrononaut: Ah, get it, thanks.

In my fork, I'm moving towards removing Liquid entirely and only using Haml, without suppressing eval, since I got frustrated working within the Liquid limitations. But this is for running on my own server, not as GitHub Pages.

@mattscilipoti

This comment has been minimized.

Show comment
Hide comment
@mattscilipoti

mattscilipoti Jun 18, 2009

+1 for haml/sass support in GitHub's Jekyll

mattscilipoti commented Jun 18, 2009

+1 for haml/sass support in GitHub's Jekyll

@TomK32

This comment has been minimized.

Show comment
Hide comment
@TomK32

TomK32 Jul 24, 2009

svenfuchs worked on a safe mode for haml (and erb as well), maybe worth looking into: http://github.com/svenfuchs/safemode/tree/master

TomK32 commented Jul 24, 2009

svenfuchs worked on a safe mode for haml (and erb as well), maybe worth looking into: http://github.com/svenfuchs/safemode/tree/master

@adamstac

This comment has been minimized.

Show comment
Hide comment
@adamstac

adamstac Sep 12, 2009

Bump.

Man I really want to go full stem ahead with using Jekyll too. But I'm a die hard Haml fan.

As a front-end developer I don't really want to bounce back and forth from HTML to Haml. That would just be torture. ;)

adamstac commented Sep 12, 2009

Bump.

Man I really want to go full stem ahead with using Jekyll too. But I'm a die hard Haml fan.

As a front-end developer I don't really want to bounce back and forth from HTML to Haml. That would just be torture. ;)

@tomash

This comment has been minimized.

Show comment
Hide comment
@tomash

tomash Aug 25, 2010

Contributor

Basically ejekyll
http://rfelix.com/2010/01/19/jekyll-extensions-minus-equal-pain/
solves this issue and many more similar ones :)

Contributor

tomash commented Aug 25, 2010

Basically ejekyll
http://rfelix.com/2010/01/19/jekyll-extensions-minus-equal-pain/
solves this issue and many more similar ones :)

@shmuel

This comment has been minimized.

Show comment
Hide comment
@shmuel

shmuel Oct 31, 2010

With the new plugin architecture available in Jekyll >0.6, adding support for HAML & SAS is a near trivial task.

See: http://blog.martiandesigns.com/2010/07/19/haml-sass-converters-for-jekyll.html

The only remaining issue (and it's a big one for me) is it seems plugins are evaluated AFTER layouts. This means the plugin method only allows HAML & SASS within pages and not layouts.

shmuel commented Oct 31, 2010

With the new plugin architecture available in Jekyll >0.6, adding support for HAML & SAS is a near trivial task.

See: http://blog.martiandesigns.com/2010/07/19/haml-sass-converters-for-jekyll.html

The only remaining issue (and it's a big one for me) is it seems plugins are evaluated AFTER layouts. This means the plugin method only allows HAML & SASS within pages and not layouts.

@shmuel

This comment has been minimized.

Show comment
Hide comment
@shmuel

shmuel Oct 31, 2010

Yeah, I've become pretty addicted to HAML these days.

I've added an issue to the project here if anyone wants to join me in asking for the current behavior to change:

http://github.com/mojombo/jekyll/issues#issue/225

shmuel commented Oct 31, 2010

Yeah, I've become pretty addicted to HAML these days.

I've added an issue to the project here if anyone wants to join me in asking for the current behavior to change:

http://github.com/mojombo/jekyll/issues#issue/225

@jinleileiking

This comment has been minimized.

Show comment
Hide comment
@jinleileiking

jinleileiking commented May 27, 2011

i want haml!

@phrozen

This comment has been minimized.

Show comment
Hide comment
@phrozen

phrozen Jun 2, 2011

HAML!!!!! PLEASEEE!!!!!

phrozen commented Jun 2, 2011

HAML!!!!! PLEASEEE!!!!!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 2, 2011

Count me in ;)

ghost commented Jun 2, 2011

Count me in ;)

@gardiner

This comment has been minimized.

Show comment
Hide comment
@gardiner

gardiner Jun 2, 2011

That would be nice indeed.

gardiner commented Jun 2, 2011

That would be nice indeed.

@rupert654

This comment has been minimized.

Show comment
Hide comment
@rupert654

rupert654 Jun 10, 2011

Now that HAML and SASS are separate, and SASS doesn't allow execution of ruby code (as far as I know), is there anything preventing its inclusion in Github pages? I can live without HAML but not SASS!

Also Jekyll converters seem to be broken recently so it is no longer possible to include them like that.

rupert654 commented Jun 10, 2011

Now that HAML and SASS are separate, and SASS doesn't allow execution of ruby code (as far as I know), is there anything preventing its inclusion in Github pages? I can live without HAML but not SASS!

Also Jekyll converters seem to be broken recently so it is no longer possible to include them like that.

@anbotero

This comment has been minimized.

Show comment
Hide comment
@anbotero

anbotero Jun 12, 2011

I just started using Jekyll, and I'm running Slim, Scss and Coffee-Script converters just fine. To me the only issue is that converters don't apply for layouts.

anbotero commented Jun 12, 2011

I just started using Jekyll, and I'm running Slim, Scss and Coffee-Script converters just fine. To me the only issue is that converters don't apply for layouts.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 27, 2011

Have there been any updates about this ticket?

I think that rupert654 brings up a valid point. I really like using Jekyll and I'm somewhat all right with not being able to use HAML, but not being able to use SASS is becoming a real deal-breaker.

What does everyone else think?

ghost commented Jul 27, 2011

Have there been any updates about this ticket?

I think that rupert654 brings up a valid point. I really like using Jekyll and I'm somewhat all right with not being able to use HAML, but not being able to use SASS is becoming a real deal-breaker.

What does everyone else think?

@rupert654

This comment has been minimized.

Show comment
Hide comment
@rupert654

rupert654 Jul 29, 2011

To be honest, maybe this feature is not that much of a necessity for Jekyll. It seems to me that one of the main priorities of Jekyll will always be to provide a safe execution environment in order to support Github Pages. That is the focus and so things like SASS support will always be secondary. There are other projects out there, Middleman for example, whose focus is to support a wide variety of templating languages, including SASS. It might be more appropriate to switch gems rather than shoehorn every feature into this one.

rupert654 commented Jul 29, 2011

To be honest, maybe this feature is not that much of a necessity for Jekyll. It seems to me that one of the main priorities of Jekyll will always be to provide a safe execution environment in order to support Github Pages. That is the focus and so things like SASS support will always be secondary. There are other projects out there, Middleman for example, whose focus is to support a wide variety of templating languages, including SASS. It might be more appropriate to switch gems rather than shoehorn every feature into this one.

@qrush

This comment has been minimized.

Show comment
Hide comment
@qrush

qrush Jan 1, 2013

Contributor

HAML/SCSS should not be added directly into Jekyll...it should be a plugin. Going to shut this one down.

Contributor

qrush commented Jan 1, 2013

HAML/SCSS should not be added directly into Jekyll...it should be a plugin. Going to shut this one down.

@qrush qrush closed this Jan 1, 2013

@kevinSuttle

This comment has been minimized.

Show comment
Hide comment
@kevinSuttle

kevinSuttle Feb 18, 2013

It might be good to establish best practices for pre-proprocessors, CSS or otherwise in the wiki somewhere. I'm specificially interested in SASS + LiveReload + Jekyll.

kevinSuttle commented Feb 18, 2013

It might be good to establish best practices for pre-proprocessors, CSS or otherwise in the wiki somewhere. I'm specificially interested in SASS + LiveReload + Jekyll.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Feb 19, 2013

Member

Feel free to add those to the Wiki :-) It's your time to innovate!

Member

parkr commented Feb 19, 2013

Feel free to add those to the Wiki :-) It's your time to innovate!

@kevinSuttle

This comment has been minimized.

Show comment
Hide comment
@kevinSuttle

kevinSuttle Feb 19, 2013

Hey you're right! It's our time, down here.

kevinSuttle commented Feb 19, 2013

Hey you're right! It's our time, down here.

@hagabaka

This comment has been minimized.

Show comment
Hide comment
@hagabaka

hagabaka Dec 4, 2014

It's nice that CoffeeScript and SASS are supported, but is there a way to provide support for HAML/Jade/Slim, and just disable any templating/execution? I just want to use them to save writing angle brackets...

hagabaka commented Dec 4, 2014

It's nice that CoffeeScript and SASS are supported, but is there a way to provide support for HAML/Jade/Slim, and just disable any templating/execution? I just want to use them to save writing angle brackets...

@ygd

This comment has been minimized.

Show comment
Hide comment
@ygd

ygd Jul 13, 2015

html syntax sucks. full haml support for github-pages please

ygd commented Jul 13, 2015

html syntax sucks. full haml support for github-pages please

@jekyll jekyll locked and limited conversation to collaborators Jul 13, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.