W3cubDocs

/Drupal 8

public function AssetResolverInterface::getCssAssets

public AssetResolverInterface::getCssAssets(AttachedAssetsInterface $assets, $optimize)

Returns the CSS assets for the current response's libraries.

It returns the CSS assets in order, according to the SMACSS categories specified in the assets' weights:

This ensures proper cascading of styles so themes can easily override module styles through CSS selectors.

Themes may replace module-defined CSS files by adding a stylesheet with the same filename. For example, themes/bartik/system-menus.css would replace modules/system/system-menus.css. This allows themes to override complete CSS files, rather than specific selectors, when necessary.

Also invokes hook_css_alter(), to allow CSS assets to be altered.

Parameters

\Drupal\Core\Asset\AttachedAssetsInterface $assets: The assets attached to the current response.

bool $optimize: Whether to apply the CSS asset collection optimizer, to return an optimized CSS asset collection rather than an unoptimized one.

Return value

array A (possibly optimized) collection of CSS assets.

See also

https://www.drupal.org/node/1887918#separate-concerns

File

core/lib/Drupal/Core/Asset/AssetResolverInterface.php, line 50

Class

AssetResolverInterface
Resolves asset libraries into concrete CSS and JavaScript assets.

Namespace

Drupal\Core\Asset

Code

public function getCssAssets(AttachedAssetsInterface $assets, $optimize);

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Asset!AssetResolverInterface.php/function/AssetResolverInterface::getCssAssets/8.1.x