(Vegvisir 2, Vegvisir 3)

VV::css()

Import and minify a CSS file.

The syntax is identical to VV::js(), and VV::embed().

Description

VV::css() imports and minifies a CSS styleheet file and returns it as a string.

Parameters

pathname

Path to a CSS stylesheet file to import relative from project root.

Example

relative

Path provided to pathname will be a relative when this parameter is true (default). Set to false to make path absolute.

Example

Return values

string

A string containing minified CSS. Please note that linebreaks are preserved.

Will return an empty string if the path provided to pathname is not a valid CSS stylesheet file, or if it failed to import.

Example

Examples

Basic usage

Let's take the following CSS stylesheet file and put it into a page.

By using VV::css() inside a style, we've enabled this stylesheet for that specific page.