Dion Moult Seriously who ever reads this description.

vtemplate 1.0.0 released

Today I’d like to release vtemplate 1.0.0. I’ve blogged about vtemplate before, but now I am relatively confident about its maturity to make an official release. Jeff Atwood has spoken about The Rule of Three in Reusable Software, and I’m happy to say that I’ve used vtemplate in far more than three sites since then. Oh, and if you are not a web developer, this post is probably not for you.

What is vtemplate?

The Git repository says it well enough: vtemplate is a boilerplate setup for starting new [web] projects which combines various industry standards. There are a few tweaks here and there, but otherwise it’s loyal to upstream. You’ll recognise many favourite technologies used in vtemplate, ranging from Stylus to Kohana to Behat. But before I run through these technologies, I’d like to highlight the ideals behind vtemplate:

  1. Favour industry standards over proprietary and personal hacks
  2. Promote standards that emphasise readable, maintainable, and simple code
  3. Don’t restrict or govern your desired code architecture

Let’s take a brief tour over the awesome stuff we get with vtemplate.

HTML5Boilerplate

You really can’t go wrong with HTML5Boilerplate. It’s a great piece of collaboration by very experienced frontend web coders and very well documented. This is a great first step to writing responsive, cross-browser, HTML5-valid code. This also brings in so many other frontend joys like HumansTXT, Modernizer, JQuery and so on.

Stylus

If If you’re using another CSS preprocessor, this’ll show you just how clean your CSS can really be. If you’re not yet using a preprocessor … well, you’ll soon find out why it’s so awesome. Admittedly Stylus isn’t as popular as the big boys like LESS, but it has a very lenient syntax and is easy to swap out.

Mustache

Learn why writing logic in your templates is evil! Stop writing Model-View-Controller and start writing Model-View-Template-Controller. Don’t let the backend team hold up the frontend or vice versa.

WYMEditor CMS

Why are your clients modifying their site with bloated CMSes and complex, unsemantic rich text WYSIWYGs? Keep things simple, and let your code govern the CMS, not the other way around. WYMEditor reads and writes directly to clean segments of frontend files and understands your CSS. Best of all, it makes it easy to review changes with version control. Read more about the simple CMS approach here.

Kohana

Modular (quite literally split into many Git submodules), PSR-0 compatible, forward thinking and high coding standards PHP web delivery mechanism with extremely flexible routing and HMVC architecture.

Composer

Composer is everything you wished PEAR could’ve been, and more.

Swiftmailer

Most webapps need a mailer library. Swiftmailer is a great one.

PHPSpec2

We all love TDD, right? BDD is even better because it’s semantic TDD! PHPSpec2 provides a really simple (but powerful) BDD tool complete with clean mocking and stubbing.

Behat and Mink

Another great tool from the same guys who brought PHPSpec2. Whereas PHPSpec covers all your unit testing, Behat is excellent for full stack and UI testing, with the beauty of a semantic Gherkin syntax. Mink is just icing on the cake, giving an easy to use abstraction to emulate browsers.

Phing

Test. Configure. Build. Deploy. Do it again!

So if you’re developing a web application with PHP, check out vtemplate :)

What’s new in vtemplate 1.0.0?

Well, apart from being the first release, where by definition everything is new, there have been a few more tweaks since my last post on it.

Feel free to fork :)


4 Comments

hari says: (1 December 2013)

I tried WYMEditor some time back on my blog, but it actually strips out some inline style information on my custom HTML code (for example, if I copy and paste HTML Syntax highlighted programs/code, it removed the inline styles embedded in the HTML). Finding that I could get no proper support on the WYMEditor forum, I reverted back to use TinyMCE.

In general WYMEditor is good for those who don’t need to directly tweak the resultant HTML code. Otherwise it can be a bit limiting, because it enforces its norms (which can be a good thing when you don’t want the authors to customize HTML, but is a bad thing when the author is also the administrator).

Dion Moult says: (2 December 2013)

Hey hari, WYMEditor strips out inline-styling on purpose and that’s actually a feature, not a bug. Inline styling is often a code smell of improper decoupling of style and content hierarchy. In fact vtemplate goes one step further to ensure that inline styles are truly stripped out.

WYMEditor’s behavior should not be confused with simplicity or limitations: it has one objective: to ensure that the markup is semantic and maintains consistent hierarchy. I believe it does it extremely well.

Of course, if you _absolutely_ want to do things your way, I respect that. Sometimes with legacy sites we don’t have a choice. WYMEditor provides a HTML code view as well for those who actually want to tweak the HTML, and vtemplate supports this too. Combined with mustache partials, I have been able to use WYMEditor to retrofit existing non-CMS sites with CMS capabilities with no need to compromise on the existing markup style – whether they use inlines, “bad” hierarchies, repetitive ids, inline javascript… So I can safely say from experience that whilst WYMEditor alone may be restrictive, by combining it with well partitioned template files that vtemplate makes easy, it can sit on top of your desired coding style quite happily :)

hari says: (2 December 2013)

But in some situations inline styles -are- needed.

As I said, in cases when you want to show a program/code in highlighted HTML, generated HTML (usually by a code-to-HTML highlighting tool) which you copy/paste may have inline styles. In fact, in such situations inline styles may be preferred because it will not pollute the global style sheet with unnecessary style classes since they are only one-time use.

I don’t think one generic rule can ever be evolved for displaying content on the web, as there are so many situations and variations. I used to be a purist myself, but I realize that the nature of evolution of HTML in itself is based on so many compromises that it may be impossible to decouple structure from presentation completely unless a new markup language is created from scratch.

Dion Moult says: (2 December 2013)

You’re right. There are certainly cases where inline styles are preferred. However in those cases it is often accompanied by a very complex interface – something that client definitely should not be editing (or if they are, they should do so via another interface).

In general WYMEditor is good for those who don’t need to directly tweak the resultant HTML code <– I agree with you completely! :)

I realize that the nature of evolution of HTML in itself is based on so many compromises that it may be impossible to decouple structure from presentation completely unless a new markup language is created from scratch. <– Definitely! The web is a hodgepodge of tech. However I'm happy to say that the trend is improving and it's starting to mature as a platform. Perhaps it'll never be 100%, but I'll push for 99% :)

Leave a Comment