SassUtils
extends CssUtils
in package
Sass Utils.
Tags
Table of Contents
- REGEX_COMMENTS = '/((?:\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)|\/\/[^\n]+)/'
- REGEX_IE_FILTERS = '/src=(["']?)(?P<url>.*?)\1/'
- REGEX_IMPORTS = '/@import (?:url\()?('|"|)(?P<url>[^'"\)\n\r]*)\1\)?;?/'
- REGEX_IMPORTS_NO_URLS = '/@import (?!url\()('|"|)(?P<url>[^'"\)\n\r]*)\1;?/'
- REGEX_URLS = '/url\((["']?)(?P<url>.*?)(\1)\)/'
- extractImports() : array<string|int, mixed>
- Extracts all references from the supplied CSS content.
- filterCommentless() : string
- Filters each non-comment part through a callable.
- filterIEFilters() : string
- Filters all IE filters (AlphaImageLoader filter) through a callable.
- filterImports() : string
- Filters all CSS imports through a callable.
- filterReferences() : string
- Filters all references -- url() and "@import" -- through a callable.
- filterUrls() : string
- Filters all CSS url()'s through a callable.
- __construct() : mixed
Constants
REGEX_COMMENTS
public
mixed
REGEX_COMMENTS
= '/((?:\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)|\/\/[^\n]+)/'
REGEX_IE_FILTERS
public
mixed
REGEX_IE_FILTERS
= '/src=(["']?)(?P<url>.*?)\1/'
REGEX_IMPORTS
public
mixed
REGEX_IMPORTS
= '/@import (?:url\()?('|"|)(?P<url>[^'"\)\n\r]*)\1\)?;?/'
REGEX_IMPORTS_NO_URLS
public
mixed
REGEX_IMPORTS_NO_URLS
= '/@import (?!url\()('|"|)(?P<url>[^'"\)\n\r]*)\1;?/'
REGEX_URLS
public
mixed
REGEX_URLS
= '/url\((["']?)(?P<url>.*?)(\1)\)/'
Methods
extractImports()
Extracts all references from the supplied CSS content.
public
static extractImports(string $content) : array<string|int, mixed>
Parameters
- $content : string
-
The CSS content
Return values
array<string|int, mixed> —An array of unique URLs
filterCommentless()
Filters each non-comment part through a callable.
public
static filterCommentless(string $content, callable $callback) : string
Parameters
- $content : string
-
The CSS
- $callback : callable
-
A PHP callable
Return values
string —The filtered CSS
filterIEFilters()
Filters all IE filters (AlphaImageLoader filter) through a callable.
public
static filterIEFilters(string $content, callable $callback) : string
Parameters
- $content : string
-
The CSS
- $callback : callable
-
A PHP callable
Return values
string —The filtered CSS
filterImports()
Filters all CSS imports through a callable.
public
static filterImports(string $content, callable $callback[, bool $includeUrl = true ]) : string
Parameters
- $content : string
-
The CSS
- $callback : callable
-
A PHP callable
- $includeUrl : bool = true
-
Whether to include url() in the pattern
Return values
string —The filtered CSS
filterReferences()
Filters all references -- url() and "@import" -- through a callable.
public
static filterReferences(string $content, callable $callback) : string
Parameters
- $content : string
-
The CSS
- $callback : callable
-
A PHP callable
Return values
string —The filtered CSS
filterUrls()
Filters all CSS url()'s through a callable.
public
static filterUrls(string $content, callable $callback) : string
Parameters
- $content : string
-
The CSS
- $callback : callable
-
A PHP callable
Return values
string —The filtered CSS
__construct()
private
final __construct() : mixed