Dependencies
When Reblocks renders a page, it collects CSS and JS dependencies from all widgets
by calling the generic-function reblocks/dependencies:get-dependencies. Also, this function
is called on the current app to get such common dependencies as jQuery and CSS framework.
If defining a custom method for the reblocks/dependencies:get-dependencies generic function,
ensure it returns a list of reblocks/dependencies:dependency objects.
Typically, there is already a JS or CSS file somewhere near the ASDF system. In this case,
use the reblocks/dependencies:make-dependency function like this:
(defmethod reblocks/dependencies:get-dependencies ((app my-app))
(list* (reblocks/dependencies:make-dependency "js/my-app.js"
:system :some-asdf-system)
(call-next-method)))Another way to specify a dependency is to use Parenscript or LASS to define JS or CSS right inside
the method. Here CSS code is defined for the widget:
(defmethod reblocks/dependencies:get-dependencies ((widget my-custom-widget))
(list*
(reblocks-lass:make-dependency
`(.my-custom-widget
:border 2px solid red
:padding 1em))
(call-next-method)))Note that this code uses the REBLOCKS-LASS:MAKE-DEPENDENCY function which is available from
the separate ASDF system REBLOCKS-LASS.