atomic-component-engine / ace

Instead of building pages, we build a system of responsive components which can be pieced together to provide a modular scalable and agile method to RWD.
http://atomic-component-engine.github.io/ace
4 stars 1 forks source link

Make including components in Jade more concise #38

Open itsravenous opened 10 years ago

itsravenous commented 10 years ago

Currently, including a component from another is a little ugly, and dependent on relative paths, meaning any future changes to the directory structure would break includes

_header.jade:

include ../../atoms/_logo/_logo

Wouldn't it be nice if we could do something like this:

_header.jade

ace_include atom logo

Point of consideration: We'd have to use Grunt to replace these with real includes, as Jade categorically does not support dynamic/variable-based includes (the templates are compiled before the data is passed in, soany variable used in a mixin will be empty at include-time). This would mean that ACE would no longer be something you can bootstrap a Jade project with, then drop, as the Grunt task would be required to keep the custom includes working. Is this something we are worried about? I feel like ACE is already a pretty highly-opinionated build stack, so I'm not sure I care too much that it would stop users from using Gulp instead, for example.

What doth @pjhauser think?

zweck commented 10 years ago

I totally agree, ace is already opinionated so if you are using it, you might as well use it!

I also think that:

ace_include atom logo

would be a really elegant solution

On 18 Jun 2014, at 14:42, Tom Jenkins notifications@github.com wrote:

Currently, including a component from another is a little ugly, and dependent on relative paths, meaning any future changes to the directory structure would break includes

_header.jade:

include ../../atoms/_logo/_logo Wouldn't it be nice if we could do something like this:

_header.jade

ace_include atom logo Point of consideration: We'd have to use Grunt to replace these with real includes, as Jade categorically does not support dynamic/variable-based includes (the templates are compiled before the data is passed in, soany variable used in a mixin will be empty at include-time). This would mean that ACE would no longer be something you can bootstrap a Jade project with, then drop, as the Grunt task would be required to keep the custom includes working. Is this something we are worried about? I feel like ACE is already a pretty highly-opinionated build stack, so I'm not sure I care too much that it would stop users from using Gulp instead, for example.

What doth @pjhauser think?

— Reply to this email directly or view it on GitHub.

itsravenous commented 10 years ago

Fantastic. Will get on that.

itsravenous commented 10 years ago

Having looked into this, we'd need to write a wrapper task for Jade which read in the files, expanded the concise form into real jade includes, and then passed that through to jade.compile. Non-trivial, but possible, I guess.