Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Attach In-Body

Security covered Under active development 2 sites

This module allows you to defer loading non-essential CSS and JavaScript until they are actually needed within the page content, rather than loading them all at the top of the document. This helps prevent a "flash of unstyled content" and improves the initial rendering speed of your pages for a better user experience.

In order to avoid a Flash of Unstyled Content (FOUC), browsers will halt rendering when they encounter a CSS include until the file is downloaded and its rules are parsed. By default, Drupal includes all page CSS in the document header, which increases the transfer and parsing time before the browser is able to first render any of the page.

By including non-essential CSS when it's first needed on the page instead of in the header, the browser can more quickly render initially visible content, providing a better experience for users.

Usage

In a template, replace {{ attach_library('extension/library') }} with {{ attach_library_inbody('extension/library') }}
Any CSS and JS assets will be rendered in that template, while any dependencies of that library will be rendered in the header or footer of the page as usual.

Resources

Drupal 10–11

Ask your assistant about Attach In-Body

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
May 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core PHP Release date
8.x-1.2 Stable 10–11 May 22, 2024