SCSS

Creates CSS output and adds to Processor object from SCSS in other plugins

Overview§

Uses the Dart CASS program to convert SCSS input into CSS output that is added to the RPO structure.

The plugin has a SCSS to CSS converter that is intended to be run once and after any other plugin that defines a scss: field in its %.config attribute in the correct manner for HTML-Extra, eg.,

    %!config =
        :scss( [ self.add-scss-string, 2], ),

In order to accomplish this, the SCSS workspace has a closure to be called with the RakuDoc-Processor (rdp) object. A renderer, eg. RakuDoc::To::HTML-Extra, will call the closure after all plugins have been enabled, eg.

$rdp.template.data<SCSS><run-sass>.$rdp )

After which $rdp.templates.data<css> will contain a string of all the CSS from each of the :scss fields concatenated in the correct order. Any existing value of :css provided by the renderer itself is assumed to have order 0.

Warnings§

  • The scss attribute must be a sequence of Str,Int tuples, eg.,

    :scss( [ '/*! Test */.bolder { font-weight:450; } ', 1 ] , ),
    

    so the comma inside the last ) is important.

  • This plugin adds CSS to the Processor instance for each plugin. If a plugin has both a :css and a :scss attribute set in its config, SCSS will ignore the :css and render the :scss. If a plugin only has a :css and no :scss, the :css value will be concatenated with the order set or with an implied order of 0.

  • It is assumed that a shell call to sass -v will yield a version number, otherwise the plugin will die.

Note that a plugin can be disabled by overriding the default plugin list (see Customisability in HTML-Extra ).

Credits§

Richard Hainsworth, aka finanalyst

VERSION§

v0.1.0