When you build & run YUIDoc it gets some of his resources from http://yui.yahooapis.com/...
. These resources include the stylesheet and yui.min.js
.
How can I download and use these resources offline?
The reason for this is because we run our docs on a HTTPS server. The YUIDoc serves his files always over HTTP protocol.
I had the same problem and I really don’t understand why the don’t have a valid certificate for
yui.yahooapis.com
. Here’s what works for me (with YUIDoc 0.5.0):Create a custom theme
First of all, you’ll need to create a new theme that overrides some parts of the default theme.
Create the following folder structure:
Modify the main layout
To avoid loading the remote CSS and scripts, you need to alter the main layout.
Copy the file called
main.handlebars
from the original theme to yourmy_theme/layouts/
folder. If you installed YUIDoc via node, the original file is located innode_modules/yuidocjs/themes/default/layouts/
. Alternatively, you can grab it from the yuidoc GitHub repo.Make the following changes in that file:
1.) Replace the
link
tag referencing the remote stylesheet:<link rel="stylesheet" href="{{yuiGridsUrl}}">
<link rel="stylesheet" href="{{projectAssets}}/css/cssgrids-min.css">
2.) Replace the
script
tag referencing the remote YUI library:<script src="{{yuiSeedUrl}}"></script>
<script src="{{projectAssets}}/yui/build/yui-base/yui-base-min.js"></script>
Add a local copy of the remote assets
1.) Fetch the CSS from Yahoo’s CDN
Download cssgrids-min.css from the Yahoo CDN and put it in your
my_theme/assets/css
folder.2.) Download the YUI 3.9.1 library
Download YUI 3.9.1 from http://yui.zenfs.com/releases/yui3/yui_3.9.1.zip (Release Notes) and put the
build
folder from the archive tomy_theme/assets/yui
.Build your docs
When building your docs, make sure you specify your custom theme:
Possible improvements
Since this adds a bunch of files to your project, it might make sense to dive a little deeper into YUIDoc and see which YUI modules are actually required and remove everything else. Also, combining the files would be desirable (the library served form Yahoo’s CDN does this and it should be possible to get this working locally as well).