SilverStripe HTML5 Boilerplate Version 2 Theme

Posted by Gav on 24 November 2011 | 3 Comments

Tags:

The HTML5 Boilerplate project released version 2 in August so its time to create a SilverStripe HTML5 Boilerplate version 2 theme.

The theme was mainly based on the BlackCandy5 theme but it uses version 2 of the HTML5 Boilerplate and i've also upgraded the jquery version to 1.7 All of the blackcandy images have been removed as well as a lot of the un-necessary styles. Also added is a default email template as from the hard yakka theme. The IE conditional statements have been removed from the BlackCandy theme.

When starting a new project, I always grab the following 2 modules:

Also, we will want to remove prototype by adding the following to mysite/_config.php

Validator::set_javascript_validation_handler('none');

Then i create a SiteConfig Extension to remove the theme drop down list from the SiteConfig as explained in this post on ssbits.com and I add other site wide configuration options.

Finally I modify the Page_Controller class init() function so that its ready to combine the javascript and css.

	public function init() {
		parent::init();

		$theme_folder = sprintf('themes/%s', SSViewer::current_theme());
		$js_files = array(
			sprintf('%s/javascript/plugins.js', $theme_folder),
			sprintf('%s/javascript/script.js', $theme_folder)
		);

		$css_files =
			array(
				sprintf('%s/css/layout.css', $theme_folder),
				sprintf('%s/css/typography.css', $theme_folder),
				sprintf('%s/css/form.css', $theme_folder),
			);
		foreach($js_files as $js) {
			Requirements::javascript($js);
		}

		foreach($css_files as $css) {
			Requirements::css($css);
		}

		Requirements::combine_files("js.js", $js_files);
		Requirements::combine_files("css.css", $css_files);
		Requirements::process_combined_files();
	}

Comments are welcome and is there anything differently you do when starting a project?

Grab the theme here


Post your comment

Comments

Gav says:

@daniel, i haven't used the 960 grid system before but it looks pretty cool. i'll see if i can add it in :)

Posted by Gav, 16th December 2011 7:56 am (5 months ago)

daniel says:

thank you for this post.
what's the best way to add 960.gs system?

Posted by daniel, 13 December 2011 (5 months ago)

Gav says:

The first thing that i've noticed after using this is that the MetaTitle field wasn't being rendered in the title tag.

i've changed:
<title>$Title &raquo; $SiteConfig.Title</title>

to:
<title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; $SiteConfig.Title</title>

The zip is updated.

Posted by Gav, 25th November 2011 9:24 am (6 months ago)

RSS feed for comments on this page | RSS feed for all comments