# 20131115 (Friday, 15 November 2013)¶

## Plugins¶

Yesterday Joe and I had our first Skype meeting which lasted about 70 minutes. We had a brainstorming about a feature Joe would like to use: allow for chunks of custom js and css files and templates. Something which should use Django’s Form Assets (the Media class).

It seems that Django does not parse these Media files nor provide a method to generate a single file from all those chunks. The whole Media class in fact is not meant for generating a file. We must differentiate between (1) self-maintained JS and CSS snippets and (2) external JS libraries. So yes, we’ll need to extend Django’s system.

After some sleep I realized that we have been looking for the name “plugin”, and that this had been already almost implemented (in djangosite.Site). But I had never started to actually use it because there was no urgent need. Now I converted use_eidreader and use_eid_jslib to “Plugins”, and it works, and everything is much cooler! I’m fascinated!

So the Site setting use_eidreader has been replaced by the lino.mixins.beid.BeIdReaderPlugin. Instead of setting use_eidreader to True you must override get_installed_plugins as follows:

def get_installed_plugins(self):
for p in super(Site,self).get_installed_plugins():
yield p

The base class is (currently) defined in djangosite.djangosite_site.Plugin and should be used from dd.Plugin.
The lino/config/plugins/eidreader.js snippet contains code which was previously in linolib.js (which definitively was not the right place)
• The next plugins will be lino.plugins.davlink.DavLinkPlugin (replacing use_davlink) and/or lino.extjs.ExtJS3Plugin (replacing use_extjs).