Y
Y
Yura Komarov2019-11-13 12:54:48
1C-Bitrix
Yura Komarov, 2019-11-13 12:54:48

How to connect styles one in the header, others in the footer?

Hello.
Since google monitors the download speed, I made 2 css files.
1) start.min.css
2) app.min.css
And I would like to include them, one in the header, the other in the footer.
Usually everyone uses the function

$assets->addCss(PUBLIC_ASSET_ROOT_PATH . '/styles/start.min.css');
$assets->addCss(PUBLIC_ASSET_ROOT_PATH . '/styles/app.min.css');

But in this version, the styles are still combined into one. If there is a way to separate them, as stated earlier?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2019-11-13
@Yurajun

Don't use $assets->addCss or don't use it for at least one style group.
I use my own way of adding styles which uses AddViewContent and ShowViewContent.
This is convenient and allows you to include styles and scripts as needed. The current implementation of connecting to Bitrix is ​​outdated by 10 years, but they won’t do it anyway - you won’t show it at the presentation.

M
Maxim Kirshin, 2019-11-13
@meowto16

// Второй параметр говорит о том, что это дополнительные стили. Должны быть в отдельном файле по идее
$assets->addCss(PUBLIC_ASSET_ROOT_PATH . '/styles/start.min.css', true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question