Skip to content

Commit

Permalink
Merge pull request #19 from juliomrqz/update
Browse files Browse the repository at this point in the history
Update HTML5 ★ Boilerplate to 4.2.0 version and fix some typos
Thanks to @juliomrqz!
  • Loading branch information
Luciano Mammino committed Aug 9, 2013
2 parents f2aefee + ffc2c81 commit 0d05e2a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OryzoneBoilerplateBundle
========================
The OryzoneBoilerplateBundle allows you to use a twig template based on the great [HTML5 ★ Boilerplate](http://html5boilerplate.com/) 4.0 by [Paul Irish](http://paulirish.com/), [Divya Manian](http://nimbupani.com/) and many other great guys.
So with this bundle you can easily create heavily optimized HTML5 twig templates empowered with great features such as CSS resets, CDNed jquery (with offline fallback), asynchronous google analytics script and so on.
So with this bundle you can easily create heavily optimized HTML5 twig templates empowered with great features such as CSS resets, CDNed jQuery (with offline fallback), asynchronous google analytics script and so on.

A little appetizer
------------------
Expand Down
17 changes: 8 additions & 9 deletions Resources/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Update the vendor libraries:

<a name="installation-step1b2"></a>
##### Using submodules
instead, if you prefer using git submodules, just proceed by running the following git commands:
Instead, if you prefer using git submodules, just proceed by running the following git commands:

$ git submodule add git://github.com/Oryzone/OryzoneBoilerplateBundle.git vendor/oryzone/boilerplate-bundle/Oryzone/Bundle/BoilerplateBundle
$ git submodule update --init
Expand Down Expand Up @@ -140,7 +140,7 @@ Make sure Assetic is configured to scan OryzoneBoilerplateBundle:
<a name="create-your-own-mighty-templates-as-extensions"></a>
Create your own mighty templates as extensions
----------------------------------------------
Now comes the most enjoying part, you've successfully installed the bundle and you're ready to go. Everything starts with a Twig template. If you want to create a new HTML5 powered template you've only to extend the `OryzoneBoilerplateBundle::html5.html.twig` template. So you need to put the following line at the beginning of yout template:
Now comes the most enjoying part, you've successfully installed the bundle and you're ready to go. Everything starts with a Twig template. If you want to create a new HTML5 powered template you've only to extend the `OryzoneBoilerplateBundle::html5.html.twig` template. So you need to put the following line at the beginning of your template:

{% extends "OryzoneBoilerplateBundle::html5.html.twig" %}

Expand All @@ -161,15 +161,15 @@ With the following code we created a simple template for an index page. As you w
<a name="available-blocks"></a>
Available blocks
----------------
The basic template structure is made of nested blocks. This template proposes a default structure, so you have to rewrite only the blocks you really need to modify (or populate). Generally, as shown in the quick demo, you'll rewrite only few of them like `head_title` and the `body_main`. The template has been tought to be flexible enough to handle most of the cases. However, if you wish to apply deep modification to the whole structure you can totally rewrite higher level blocks like `head` or `body`.
The basic template structure is made of nested blocks. This template proposes a default structure, so you have to rewrite only the blocks you really need to modify (or populate). Generally, as shown in the quick demo, you'll rewrite only few of them like `head_title` and the `body_main`. The template has been thought to be flexible enough to handle most of the cases. However, if you wish to apply deep modification to the whole structure you can totally rewrite higher level blocks like `head` or `body`.
Follows a representation of the blocks tree. Note that every block name is prefixed with the name of his ancestor blocks.

* <strong>head</strong>
* <strong>head\_meta</strong>
* <strong>head\_meta\_description</strong>
* <strong>head\_meta\_keywords</strong>
* <strong>head\_meta\_viewport\_tag</strong>
* <strong>head\_meta\_viewport\_tag\_content</strong>
* <strong>head\_meta\_viewport\_tag\_content</strong>
* <strong>head\_title</strong>
* <strong>head\_css</strong>: Contains a reference to the basic css reset
* <strong>head\_js</strong>: adds modernizr script. All the other script should be added inside the <strong>body\_js</strong> block
Expand Down Expand Up @@ -203,7 +203,7 @@ The template uses some variables that you can optionally redefine to customize i
<a name="two-different-approaches"></a>
Two different approaches: overwrite and extend
----------------------------------------------
If you're alredy experienced with Twig this paragraph would be pointless, so feel free to skip it on if you are confortable with Twig inheritance based paradigm.
If you're already experienced with Twig this paragraph would be pointless, so feel free to skip it on if you are comfortable with Twig inheritance based paradigm.

Basically there are two ways to deal with a block: by complete overwriting the content of its parent block or by reusing and extending it.

Expand Down Expand Up @@ -242,7 +242,7 @@ Instead if you want to add some more stylesheet to the default one you can use t

{# ... #}

Note that if you overwrite an higher level block as `head` you'll automatically overwrite all it's nested blocks as `head_title` and `head_css`. This makes Twig pretty flexible because you have the full control of everything you wish to change or extend. Blocks can be considered just as starting points or suggestions on which you can build upon.
Note that if you overwrite an higher level block as `head` you'll automatically overwrite all its nested blocks as `head_title` and `head_css`. This makes Twig pretty flexible because you have the full control of everything you wish to change or extend. Blocks can be considered just as starting points or suggestions on which you can build upon.

<a name="configure-google-analytics"></a>
Configure Google Analytics
Expand Down Expand Up @@ -277,7 +277,7 @@ If you want your templates to reflect your global locale configuration you can p
Adding classes to the html tag
------------------------------
Sometimes is quite useful to add a class on the `html` tag. Modernizr does this all the time to let you build your css and being aware of the capabilities of the current browser.
It's also a common practice adding classes that specify, for example, the current section, the language or other useful attributes tath can be useful to provide specific style variations on your css files.
It's also a common practice adding classes that specify, for example, the current section, the language or other useful attributes that can be useful to provide specific style variations on your css files.
Suppose you want to have the navigation bar with a different background color on each page of your website. You can add a specific class on the `html` tag of every page (e.g.`class="section-home"` or `class="section-contacts"`) and then provide some css rules of this kind:

html.section-home nav
Expand All @@ -291,8 +291,7 @@ Suppose you want to have the navigation bar with a different background color on
}

To specify additional classes for your head tag you must assign a value to the `bp_html_classes` variable.
You can do so by passing a value from the controller, but, in my opinion this is not a controller duty. So it would be fairly better to set a value
directly the template (which extends the boilerplate template). So you do something like this in your templates.
You can do so by passing a value from the controller, but, in my opinion this is not a controller duty. So it would be fairly better to set a value directly the template (which extends the boilerplate template). So you do something like this in your templates.

{% set bp_html_classes = "section-home" %}

Expand Down
4 changes: 2 additions & 2 deletions Resources/public/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body {

/*
* Remove text-shadow in selection highlight: h5bp.com/i
* These selection declarations have to be separate.
* These selection rule sets have to be separate.
* Customize the background color to match your design.
*/

Expand Down Expand Up @@ -212,7 +212,7 @@ textarea {

/* ==========================================================================
EXAMPLE Media Queries for Responsive Design.
Theses examples override the primary ('mobile first') styles.
These examples override the primary ('mobile first') styles.
Modify as content requires.
========================================================================== */

Expand Down
18 changes: 12 additions & 6 deletions Resources/public/css/normalize.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! normalize.css v1.1.0 | MIT License | git.io/normalize */
/*! normalize.css v1.1.1 | MIT License | git.io/normalize */

/* ==========================================================================
HTML5 display definitions
Expand Down Expand Up @@ -59,16 +59,22 @@ audio:not([controls]) {
========================================================================== */

/**
* 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using
* 1. Prevent system color scheme's background color being used in Firefox, IE,
* and Opera.
* 2. Prevent system color scheme's text color being used in Firefox, IE, and
* Opera.
* 3. Correct text resizing oddly in IE 6/7 when body `font-size` is set using
* `em` units.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* 4. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/

html {
font-size: 100%; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
background: #fff; /* 1 */
color: #000; /* 2 */
font-size: 100%; /* 3 */
-webkit-text-size-adjust: 100%; /* 4 */
-ms-text-size-adjust: 100%; /* 4 */
}

/**
Expand Down
4 changes: 0 additions & 4 deletions Resources/public/js/vendor/jquery-1.9.0.min.js

This file was deleted.

5 changes: 5 additions & 0 deletions Resources/public/js/vendor/jquery-1.9.1.min.js

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions Resources/views/html5.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="{% block head_meta_description %}{% endblock %}">
<meta name="viewport" content="width=device-width">
<meta name="keywords" content="{% block head_meta_keywords %}{% endblock %}">
{% block head_meta_viewport_tag %}<meta name="viewport" content="{% block head_meta_viewport_tag_content %}width=device-width{% endblock %}">{% endblock %}
{% endblock head_meta %}
Expand All @@ -18,7 +19,7 @@

{% block head_css %}
{% stylesheets
'@OryzoneBoilerplateBundle/Resources/public/css/normalize.css'
'@OryzoneBoilerplateBundle/Resources/public/css/normalize.css'
'@OryzoneBoilerplateBundle/Resources/public/css/main.css'
%}
<link rel="stylesheet" href="{{ asset_url }}" >
Expand All @@ -37,7 +38,9 @@
<body {{bp_body_attributes|default('')|raw}}>
{%block body%}
{% block body_chromeframe %}
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
{% endblock body_chromeframe %}
{%block body_container%}
<div id="container">
Expand All @@ -53,8 +56,8 @@
</div>
{%endblock body_container%}
{% block body_js %}
{% block body_js_jquery %}<script src="{% block body_js_jquery_onlineSrc %}//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js{% endblock %}"></script>
<script>window.jQuery || document.write('<script src="{% block body_js_jquery_offlineSrc %}{% javascripts '@OryzoneBoilerplateBundle/Resources/public/js/vendor/jquery-1.9.0.min.js' %}{{ asset_url }}{% endjavascripts %}{% endblock %}"><\/script>')</script>
{% block body_js_jquery %}<script src="{% block body_js_jquery_onlineSrc %}//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js{% endblock %}"></script>
<script>window.jQuery || document.write('<script src="{% block body_js_jquery_offlineSrc %}{% javascripts '@OryzoneBoilerplateBundle/Resources/public/js/vendor/jquery-1.9.1.min.js' %}{{ asset_url }}{% endjavascripts %}{% endblock %}"><\/script>')</script>
{% endblock body_js_jquery %}
{% block body_js_analytics %}
{% if bp_analytics_id|default(none) %}
Expand All @@ -68,11 +71,9 @@
{% endblock %}
{% block body_js_analytics_track %}_gaq.push(['_trackPageview']);{% endblock %}
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src='//www.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
{% endif %}
{% endblock body_js_analytics %}
Expand Down

0 comments on commit 0d05e2a

Please sign in to comment.