Document assetlink and staticdirect usage for plugins.

Still a bit to clean up around what the command to be run actually is,
since that will likely change.

This commit sponsored by David Decker.  Thank you!
This commit is contained in:
Christopher Allan Webber 2013-05-22 11:51:46 -05:00
parent 2f21842159
commit 505b4b39b8

View File

@ -144,3 +144,34 @@ passes back a PluginStatic object.
.. automodule:: mediagoblin.tools.staticdirect
:members: PluginStatic
Running plugin assetlink
++++++++++++++++++++++++
.. TODO: Fix this command when it lands elsewhere ;)
In order for your plugin assets to be properly served by MediaGoblin,
your plugin's asset directory needs to be symlinked into the directory
that plugin assets are served from. To set this up, run::
./bin/gmg theme assetlink
Using staticdirect
++++++++++++++++++
Once you have this, you will want to be able to of course link to your
assets! MediaGoblin has a "staticdirect" tool; you want to use this
like so in your templates::
staticdirect("css/monkeys.css", "mystaticname")
Replace "mystaticname" with the name you passed to PluginStatic. The
staticdirect method is, for convenience, attached to the request
object, so you can access this in your templates like:
.. code-block:: html
<img alt="A funny bunny"
src="{{ request.staticdirect('images/funnybunny.png', 'mystaticname') }}" />