Skip to content

Stylesheets ​

A StyleSheet is a compiled CSS bundle (optional SCSS / raw CSS / utilities) plus framework metadata. Layout builders attach sheets; public pages receive <link> tags via StylesheetManager.

Unlike LayoutBuilder / PageLayout, stylesheets are not Blade blade_source trees — output is CSS on a filesystem disk + an optional public HTTP route.

Ordering ​

For one sheet (linkHrefsForSheet):

  1. Framework link hrefs (from sheet definition + config maps: Bootstrap / Tailwind)
  2. Public compiled bundle URL (cms.public.stylesheet) when the sheet is published and the public route is enabled

For a LayoutBuilder: primary style_sheet_id, then each style_sheet_slugs entry (published only; missing/unpublished skipped; duplicate ids/hrefs deduped).

Where compiled CSS lives ​

ConfigDefaultMeaning
cms_stylesheets.compiled_disklocalLaravel filesystem disk
cms_stylesheets.compiled_directorymodularous/cms/stylesheetsDirectory on that disk (no leading/trailing slash)

Typical local path: storage/app/modularous/cms/stylesheets/… (depends on the local disk root).

Persisted via StyleSheetRepository. Optional SCSS: cms_stylesheets.scssphp.enabled (default false; needs scssphp/scssphp).

Other caps:

KeyDefault
max_raw_css_bytes512000
max_inline_vendor_css_bytes2000000
utilities_class_prefixu-
allow_http_fetch_for_inline_mergefalse

Public CSS route ​

Registered in CmsPublicSystemRoutes:

GET /{path_prefix}/{slug}.css
ConfigDefault
public_route.enabledtrue
public_route.path_prefixcms/stylesheets
public_route.max_age_seconds3600
public_route.cache_bust_querytrue
public_route.cache_bust_paramv

Bound to the public front domain; catch-all excludes this prefix automatically (Public routing).

Manual rebuild: POST api/cms/style-sheets/{id}/recompile when your API middleware allows it.

Framework href maps ​

Config nests bootstrap.* and tailwind.* map versions → vendor/CDN/build CSS (and Bootstrap JS bundle) paths. Demo assets ship under public/vendor/cms-stylesheet-examples/… and public/build/cms-stylesheet-examples/…. Prefer local / paths; HTTP fetch for inlining is off by default.

Blade snippet ​

php
@foreach (\Modules\Cms\Support\StylesheetManager::linkHrefsForLayoutBuilder($layoutBuilder) as $href)
    <link rel="stylesheet" href="{{ $href }}">
@endforeach

Config ​

Full table: Configuration → modularous.cms_stylesheets.

Next: Layout builders (attach sheets to a document shell).