Blog

The beauty of boilerplate

Wednesday 4th May 2011

The beauty of boilerplate

Every project we undertake will involve doing something we've done before. In fact there are some things we have to do for every project and I'm not talking about our processes or project management milestones. I'm talking code.

Pretty much all our projects involve creating HTML templates with accompanying CSS and JavaScript files and whilst each template will look completely different, certain aspect of the code are present in every one. Think of it as the foundation we lay each time to build the templates on.

Think of it as the foundation we lay each time to build the templates on.

Now, this sounds a bit tedious, having to write out the same code for each project and that's where boilerplates come in. We have developed two sets of files that we use as the starting point for every project. We have one for XHTML 4.01 and one for HTML 5. Why two? Well HTML 5 is technically still a draft format and some of our clients are focused on older browsers that don't support HTML 5. We appreciate there are workarounds to aid compatibility but if the target browser doesn't support it and we're not using its features then there is no necessity to use it. That said, we are always keen to use HTML 5 where we feel it is appropriate, such as this site and the Badge Collectors Circle website.

So what's in the boilerplate? The boilerplates consist of an index.html file containing links to relevant style sheets and JavaScript. The excellent HTML 5 boilerplate is a great example, which we'd recommend to anyone who's yet to adopt a boilerplate.

Another point worth noting is that the boilerplate should always be reviewed and improved. This is a great advantage to using the HTML5 boilerplate as it is always being updated and they encourage you to tailor it to suit your needs. In fact there are a lot of added extras in the HTML5 boilerplate that you won’t need for every project. Some argue that this makes it less of a boilerplate as you need to remove bits before starting but we think it’s easier to hit delete than go searching for bits of code!

Get in touch

If you like the sound of Hark 2 and think you can benefit from our skills, please download the Project Enquiry Survey below, fill it out and send it back to hello@hark2.com.

Download the Project Enquiry Survey
  • 31 Rutland Street, Leicester, LE1 1RE
  • +44 (0)116 261 6842

Send us a message

*Required field

Please fill out the form below and we'll get back to you.

*
*

*
Send
Web Design Leicester