Apply
Dependencies can apply
stylesheets and scripts in plugins to the pages in our project using glob patterns.
Styles
To apply the stylesheet in the std::core
plugin to all pages the dependency would look like this:
= { = "~4", = { = ["**"] } }
The paths used when applying styles and scripts are glob patterns for destinations; so if instead of all pages we only wanted to apply to direct descendants of our docs
folder we could do:
= { = "~4", = { = ["/docs/**"] } }
Or for all pages in the docs
folder:
= { = "~4", = { = ["/docs/**/**"] } }
Scripts
To add scripts to our pages we apply patterns in scripts
. For example the std::sidebar plugin has a tiny script to recall the open state of the sidebar as we navigate. To use the script in all our pages we apply it like this:
[]
= "~1"
= { = [ "**" ], = [ "**" ] }}
Notice plugins can supply stylesheets and scripts and we can choose how to apply them to our pages.
Filters
Applying styles or scripts will apply all the files a plugin defines but sometimes it is preferable to choose from variations that a plugin offers.
An alternative syntax lets us apply to
pages using a filter
match against each file name, for example:
[]
= "~1"
= { = [ { = "**", = "base16-*.css" } ] }
Will include all the style sheets in the std::syntax
plugin whose name begins with base16-
and applies them to every page.