diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-05-16 15:21:46 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-05-16 15:21:46 +0300 |
commit | 1ba7fb4e594d1ff1d96aff300c79fea0a4e3ca5f (patch) | |
tree | 72e3290b1532f22131a8d187b0aa4f9b5400cfb4 | |
parent | code style (diff) | |
download | sorting-algorithms-1ba7fb4e594d1ff1d96aff300c79fea0a4e3ca5f.tar.gz sorting-algorithms-1ba7fb4e594d1ff1d96aff300c79fea0a4e3ca5f.zip |
more flexible prerequisite management
* Move external <link>s and <script>s into separate includes.
* Opt for minified versions of external CSS stylesheets and JavaScript
files by default, allowing to use the properly formatted versions during
development using _config.yml.
* External components versions are now in the config file.
-rw-r--r-- | _config.yml | 5 | ||||
-rw-r--r-- | _includes/bootstrap_css.html | 5 | ||||
-rw-r--r-- | _includes/bootstrap_js.html | 5 | ||||
-rw-r--r-- | _includes/footer.html | 4 | ||||
-rw-r--r-- | _includes/header.html | 8 | ||||
-rw-r--r-- | _includes/ie_compat.html | 11 | ||||
-rw-r--r-- | _includes/jquery.html | 5 |
7 files changed, 35 insertions, 8 deletions
diff --git a/_config.yml b/_config.yml index 9dab5e6..8145ee1 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,8 @@ baseurl: /sorting_algorithms paginate: 10 include_comments: true +bootstrap_version: 3.2.0 +jquery_version: 1.11.0 +html5shiv_version: 3.7.2 +respond_version: 1.4.2 +minified_externals: true diff --git a/_includes/bootstrap_css.html b/_includes/bootstrap_css.html new file mode 100644 index 0000000..f47b856 --- /dev/null +++ b/_includes/bootstrap_css.html @@ -0,0 +1,5 @@ +{% if site.minified_externals %} + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/{{ site.bootstrap_version }}/css/bootstrap.min.css"> +{% else %} + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/{{ site.bootstrap_version }}/css/bootstrap.css"> +{% endif %} diff --git a/_includes/bootstrap_js.html b/_includes/bootstrap_js.html new file mode 100644 index 0000000..e724257 --- /dev/null +++ b/_includes/bootstrap_js.html @@ -0,0 +1,5 @@ +{% if site.minified_externals %} + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/{{ site.bootstrap_version }}/js/bootstrap.min.js"></script> +{% else %} + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/{{ site.bootstrap_version }}/js/bootstrap.js"></script> +{% endif %} diff --git a/_includes/footer.html b/_includes/footer.html index a2defdc..8432483 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -19,7 +19,7 @@ </footer> </div> </div> - <script src="//code.jquery.com/jquery-1.11.0.js"></script> - <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.js"></script> + {% include jquery.html %} + {% include bootstrap_js.html %} </body> </html> diff --git a/_includes/header.html b/_includes/header.html index e21a1a6..598fc49 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -7,18 +7,14 @@ <title>{{ page.title }}</title> - <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css"> + {% include bootstrap_css.html %} <link rel="stylesheet" href="{{ site.baseurl }}/css/footer.css"> <link rel="stylesheet" href="{{ site.baseurl }}/css/misc.css"> <link rel="stylesheet" href="{{ site.baseurl }}/css/plots.css"> <link rel="stylesheet" href="{{ site.baseurl }}/css/syntax.css"> - <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> - <script src="//oss.maxcdn.com/html5shiv/3.7.2/html5shiv.js"></script> - <script src="//oss.maxcdn.com/respond/1.4.2/respond.js"></script> - <![endif]--> + {% include ie_compat.html %} </head> <body> <script src="{{ site.baseurl }}/js/common.js"></script> diff --git a/_includes/ie_compat.html b/_includes/ie_compat.html new file mode 100644 index 0000000..3cef67d --- /dev/null +++ b/_includes/ie_compat.html @@ -0,0 +1,11 @@ +{% if site.minified_externals %} + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/{{ site.html5shiv_version }}/html5shiv.min.js"></script> + <script src="https://oss.maxcdn.com/respond/{{ site.respond_version }}/respond.min.js"></script> + <![endif]--> +{% else %} + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/{{ site.html5shiv_version }}/html5shiv.js"></script> + <script src="https://oss.maxcdn.com/respond/{{ site.respond_version }}/respond.js"></script> + <![endif]--> +{% endif %} diff --git a/_includes/jquery.html b/_includes/jquery.html new file mode 100644 index 0000000..aa6d2fd --- /dev/null +++ b/_includes/jquery.html @@ -0,0 +1,5 @@ +{% if site.minified_externals %} + <script src="https://code.jquery.com/jquery-{{ site.jquery_version }}.min.js"></script> +{% else %} + <script src="https://code.jquery.com/jquery-{{ site.jquery_version }}.js"></script> +{% endif %} |