brolik / async-css
Asynchronously load css
Installs: 184
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- php: ^7.2.5|^8.0
- craftcms/cms: ~4.0
README
Asynchronously load css
Requirements
This plugin requires Craft CMS 3.0.0-beta.23 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require brolik/async-css
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Async Css.
Async Css Overview
Includes, and adds a version to css files for async loading with a no script fall back. Css files will only be included once per page.
Using Async Css
Including a css file
{{ craft.asyncCss.load('path/to/file', $async, $cached) }}
Params
Param | Type | Default | Description |
---|---|---|---|
Path | String | null |
The path to your css file within the web folder |
Async | Boolean | true |
If the file should be loaded via async |
Cached | Boolean | true |
Include a ?v=mtime query string on the end of the href. Based off the files last modified time. |
To Class Filter
Converts a string to a css friendly class name by converting to lower case, stripping, white space, and converting to kebab case.
{{ "some string" | toClass }}
Brought to you by Jassok