Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f99aebd

Browse files
committedMay 5, 2015
Implemented use_cdn + use_bundles
1 parent 6df5331 commit f99aebd

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
 

‎nikola/data/themes/bootstrap3/templates/base_helper.tmpl

+8-4
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ lang="${lang}">
6868
<%def name="late_load_js()">
6969
%if use_bundles:
7070
%if use_cdn:
71-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
72-
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
71+
% for url in cdn_js_urls:
72+
<script src="${url}"></script>
73+
% endfor
7374
%endif
7475
<script src="/assets/js/all.js"></script>
7576
%else:
7677
%if use_cdn:
78+
FOO
7779
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
7880
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
7981
%else:
@@ -94,12 +96,14 @@ lang="${lang}">
9496
<%def name="html_stylesheets()">
9597
%if use_bundles:
9698
%if use_cdn:
97-
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
99+
% for url in cdn_css_urls:
100+
<link href="${url}" rel="stylesheet">
101+
% endfor
98102
%endif
99103
<link href="/assets/css/all.css" rel="stylesheet" type="text/css">
100104
%else:
101105
%if use_cdn:
102-
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
106+
- <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
103107
%else:
104108
<link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
105109
%endif

‎nikola/plugins/task/bundles.py

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def build_bundle(output, inputs):
132132
t_files.append(i)
133133

134134
_files = t_files
135+
self.site.GLOBAL_CONTEXT['cdn_js_urls'] = self.cdn_js_urls
136+
self.site.GLOBAL_CONTEXT['cdn_css_urls'] = self.cdn_css_urls
135137

136138
output_path = os.path.join(kw['output_folder'], name)
137139
dname = os.path.dirname(name)

0 commit comments

Comments
 (0)
Please sign in to comment.