Skip to content

Commit 27d17f2

Browse files
committedMay 29, 2015
add extra_js support in tutorial code
1 parent ac90461 commit 27d17f2

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed
 

Diff for: ‎stories/creating-a-theme.txt

+18-13
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,11 @@ our conventions::
190190
$ mkdir -p themes/lanyon/assets/css
191191
$ cp ../lanyon/public/css/lanyon.css themes/lanyon/assets/css/
192192
$ cp ../lanyon/public/css/poole.css themes/lanyon/assets/css/
193-
$ cp ../lanyon/public/css/syntax.css themes/lanyon/assets/css/code.css
194193

195-
Notice we renamed ``syntax.css`` as ``code.css``? That's because Nikola handles that specific stylesheet
196-
in a particular way, because we have a setting called ``CODE_COLOR_SCHEME`` where you can configure
197-
what color scheme the syntax highlighter uses. Having your own ``assets/css/code.css`` just makes it work.
198-
199-
**FIXME:** The syntax highlighting is broken, needs fixing.
194+
Notice I am *not* copying ``syntax.css``? That's because Nikola handles that styles for syntax highlighting
195+
in a particular way, using a setting called ``CODE_COLOR_SCHEME`` where you can configure
196+
what color scheme the syntax highlighter uses. You can use your own ``assets/css/code.css`` if you
197+
don't like the provided ones.
200198

201199
But how do I tell **our** lanyon theme to use those CSS files instead of whatever it's using now?
202200
By giving our theme its own base_helper.tmpl
@@ -233,21 +231,17 @@ And we will change it so it uses the lanyon styles instead of theme.css (again,
233231

234232
<%def name="html_stylesheets()">
235233
%if use_bundles:
236-
%if use_cdn:
237-
<link href="/assets/css/all.css" rel="stylesheet" type="text/css">
238-
%else:
239-
<link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
240-
%endif
234+
<link href="/assets/css/all.css" rel="stylesheet" type="text/css">
241235
%else:
242236
<link href="/assets/css/rst.css" rel="stylesheet" type="text/css">
243237
<link href="/assets/css/lanyon.css" rel="stylesheet" type="text/css">
244238
<link href="/assets/css/poole.css" rel="stylesheet" type="text/css">
245239
<link href="/assets/css/code.css" rel="stylesheet" type="text/css">
246-
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700|PT+Sans:400">
247240
%if has_custom_css:
248241
<link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
249242
%endif
250243
%endif
244+
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700|PT+Sans:400">
251245
</%def>
252246

253247
.. figure:: /images/lanyon-1.thumbnail.png
@@ -752,7 +746,18 @@ Doing the same for layout-reverse, sidebar-overlay and the rest is left as an ex
752746
Bundles
753747
-------
754748

755-
I promised to get to bundles. Sadly I ran out of steam. To be done soon.
749+
If you have ``WebAssets`` installed and the ``USE_BUNDLES`` option set to True, Nikola can put several CSS or JS files together in a larger file,
750+
which makes sites load faster. To do that, your theme needs a ``bundles`` file where the syntax is::
751+
752+
outputfile1.js: thing1.js, thing2.js, ...
753+
outputfile2.css: thing1.css, thing2.css, ...
754+
755+
For this theme, it should be like this::
756+
757+
assets/css/all.css=rst.css,code.css,lanyon.css,poole.css
758+
759+
**Note:** Some themes also support the ``USE_CDN`` option meaning that in some cases it will load one bundle with all CSS and in other will load some CSS files
760+
from a CDN and others from a bundle. This is complicated and probably not worth the effort.
756761

757762
The End
758763
-------

0 commit comments

Comments
 (0)
Please sign in to comment.