class CssCollectionOptimizer implements AssetCollectionOptimizerInterface (View source)

Optimizes CSS assets.

Properties

protected CssCollectionGrouper $grouper

A CSS asset grouper.

protected CssOptimizer $optimizer

A CSS asset optimizer.

protected AssetDumper $dumper

An asset dumper.

protected StateInterface $state

The state key/value store.

protected FileSystemInterface $fileSystem

The file system service.

Methods

__construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state, FileSystemInterface $file_system)

Constructs a CssCollectionOptimizer.

array
optimize(array $css_assets)

Optimizes a collection of assets.

string
generateHash(array $css_group)

Generate a hash for a given group of CSS assets.

string[]
getAll()

Returns all optimized asset collections assets.

deleteAll()

Deletes all optimized asset collections assets.

Details

__construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state, FileSystemInterface $file_system)

Constructs a CssCollectionOptimizer.

Parameters

AssetCollectionGrouperInterface $grouper

The grouper for CSS assets.

AssetOptimizerInterface $optimizer

The optimizer for a single CSS asset.

AssetDumperInterface $dumper

The dumper for optimized CSS assets.

StateInterface $state

The state key/value store.

FileSystemInterface $file_system

The file system service.

array optimize(array $css_assets)

Optimizes a collection of assets.

Parameters

array $css_assets

Return Value

array

An optimized asset collection.

protected string generateHash(array $css_group)

Generate a hash for a given group of CSS assets.

Parameters

array $css_group

A group of CSS assets.

Return Value

string

A hash to uniquely identify the given group of CSS assets.

string[] getAll()

Returns all optimized asset collections assets.

Return Value

string[]

URIs for all optimized asset collection assets.

deleteAll()

Deletes all optimized asset collections assets.