Description logic of the color change from the admin. panel OkayCMS 3. *

Categories

A new block has appeared in the design settings for customizing colors

These colors are written to a separate file in the template, which is located in design / theme / css / theme-settings.css and looks like this

These are CSS variables, but since browser support for them is still weak, we compiled the CSS files, and wherever the variable was used

in the original file (which remains, nothing happens to it) is replaced by the value of this variable in the compiled file

It is also advisable to use these variables now when developing modules so that the modules immediately fit into the style of the site.

Registration of CSS and JS files has been done. To do this, you need to register them in design / theme / js.php and design / theme / css.php in this form

You need to return an array of objects of type Okay \ Core \ TemplateConfig \ Js or Okay \ Core \ TemplateConfig \ Css.
We tried to describe these classes in as much detail as possible.

Now you don't need to write a lot of CSS and JS files in HTML. All registered files will be compiled into one output file (which is minified), unless otherwise specified in the parameters. They will connect like this:

Inside the file will contain all the files included in it in the same order as their registration.
Cache files are sensitive to changes to their original files, i.e. if you change the original file, then the cache will be updated automatically.

Now only external resources need to be connected via <script> or <link>.

If you need to include some script or style file by condition, for example, "share" in the product card and blog. You need to use Smarty plugins {js} and {css} with the following parameters:
file or filename is the name of the file,
dir - path to the script folder relative to the site root,
defer - whether the defer attribute is needed (applies only to the js plugin)

Comments 2
Aleksandr
28.03.2021, 12:36
Настройка цветов шаблона не работает выдает ошибку 404, и та же ошибка при смене карты гугл мапс, в чем причина сайт/backend/index.php?controller=SettingsThemeAdmin по этой ссылке ничего не работает при нажатии применить, даже если ничего не меняешь и нажимаешь применить ошибка 404, в чем может быть проблема?
Administrator
30.03.2021, 17:23
Aleksandr, проблема была в настройках хостинга. Уже решено
Алик
18.09.2019, 15:22
Всё это конечно здорово, но хотелось бы апробировать - где можно скачать релиз?
Администратор
18.09.2019, 15:36
Алик, прям с главной страницы. Или по ссылке okay-cms.com/versions/OkayCMS.zip
Write your comment
log in
Download OkayCMS
version 4.2.1
Subscribe to the newsletter
You will receive a selection of useful articles on working with the site on OkayCMS, discounts on modules and templates