SCSS Compiler

The SCSS Compiler provides a mechanism to translate style files written to the SCSS format into CSS files. The actual compiler is the SCSSPHP compiler that is added as a plugin supplied with Paloose (1.19.x), and is the WP-SCSS version used within the latest version of WordPress. Paloose will work fine if you don't need this facility and you can remove SCSSPHP from the plugins folder.

Note
The SCSSCompiler relies on SCSSPHP module by Leaf Corcoran and is copyright to him. It is installed in the Paloose plugin folder. This will happen naturally when a full Paloose installation is done. My thanks to him for this work.

The SCSS compiler must be considered as a transformer from its behaviour: it must not appear first or last in a pipeline line (i.e. not before a generator or after a serializer). It is declared in the transformers declaration of the sitemap as

<map:transformers default="xslt"> <map:transformer name="scss" src="resource://lib/scss/SCSSCompiler"> <map:parameter name="src" value="context://resources/scss"/> <map:parameter name="dst" value="context://resources/styles"/> <map:parameter name="compact" value="no"/> </map:transformer> </map:transformers>

where the parameters are

The default values given above should be always used unless there is a particular reason. Using the component is simple, place it anywhere within a sitemap pipeline as a transformer:

<map:match pattern="*.html"> <map:aggregate element="root" label="aggr-content"> <map:part src="context://content/breadcrumbs.xml" element="breadcrumbs" strip-root="true"/> <map:part src="context://content/menus.xml" element="menus" strip-root="true"/> <map:part src="cocoon:/{1}.xml" element="content" strip-root="true"/> </map:aggregate> <map:transform src="context://resources/transforms/page2xhtml.xsl" label="page-transform"> <map:parameter name="page" value="{1}"/> <map:parameter name="baseDir" value="context://"/> </map:transform> <map:transform type="scss" label="scss-content" <map:serialize type="xhtml"/> </map:match>

which would compile any scss file in the src folder to the dst folder. If anything in the pipeline relies on generated CSS then the pipeline stage should be moved earlier in the pipeline (but not before the generation stage (the aggregate in the example following). If the scss file has not changed then the compiler uses the already existing css file.

<map:match pattern="*.html"> <map:aggregate element="root" label="aggr-content"> <map:part src="context://content/breadcrumbs.xml" element="breadcrumbs" strip-root="true"/> <map:part src="context://content/menus.xml" element="menus" strip-root="true"/> <map:part src="cocoon:/{1}.xml" element="content" strip-root="true"/> </map:aggregate> <map:transform type="scss" label="scss-content" <map:transform src="context://resources/transforms/page2xhtml.xsl" label="page-transform"> <map:parameter name="page" value="{1}"/> <map:parameter name="baseDir" value="context://"/> </map:transform> <map:serialize type="xhtml"/> </map:match>
Copyright 2006 – 2020 Hugh Field-Richards. All Rights Reserved.