google / web-starter-kit

Web Starter Kit - a workflow for multi-device websites
http://developers.google.com/web/starter-kit
Apache License 2.0
18.42k stars 3.01k forks source link

fileinclude for partials #385

Closed cmcky closed 9 years ago

cmcky commented 10 years ago

Can we add a gulp task to provide basic templating options to include partials (nav, footers, etc)?

cmcky commented 10 years ago

Am I missing something here? Or is everyone doing custom solutions for partials? It seems like such an obvious exclusion from the build process. I recommend having a _partials directory, add a task to the build process that scans the directory and inserts partials into any html files that reference them.

kevva commented 10 years ago

You could super easily add this yourself by installing gulp-jade or your template engine of choice and making some changes in your gulpfile.

cmcky commented 10 years ago

Thanks @kevva, I have looked at both jade and mustache. However while they are great templating options, I thought they were an overkill for my needs. Instead, I have used the .tpl.html structure documented here.

As a starter-kit, I thought it would be handy to have this built in by default and was curious as to how other people were doing this.

gauntface commented 10 years ago

I've been curious about this kind of thing as well.

At the moment WSK is geared at creating static sites, but whenever I've looked at templating, it's normally been to work with some kind of back-end and to get a back end, templating and WSK playing nicely together requires some tweaks to the gulp file (not too much, but can be fiddly).

I'd love to get people's opinions on how best to solve this kind of problem.

I've considered the best approach to be to separate the tasks for HTML, CSS & JS.

That way you can drop HTML in place of templates, CSS and JS can then continue as they are. At the moment HTML and JS are still dependant on each other due to the JavaScript build blocks.

addyosmani commented 9 years ago

After considering the inclusion of partials, we've decided that this is outside the scope of WSK. This project is going to continue trying to find a sweet spot of tooling for beginner-intermediate front-end developer and if you're using templating and partials, you're probably already on the more advanced side of things. I could also suggest that it's fairly straight-forward to install support for jade :)