Combinator

Combine js and css files

The Combinator plugin is designed to combine several .js and .css files passed by the $out['compopup'] variable (system/header.php) so as to reduce page loading time.

#1. Plugin purpose

Reduce time losses required to handle and download each .js and .css file by combining all .js or .css files into one file.

#2. How it works

The plugin receives value of the $out['compopup'] var, selects all javascript, css and CDATA files and returns $out['compopup'] containing:

<script type="text/javascript" src="javascript/jquery.js,base.js,plugins/an_3DtagCloud/jvclouds3D/swfobject.js,jquery.form.js,jquery.effects.core.js"></script>
<link rel="stylesheet" type="text/css" href="style/plugins/tags/style.css,skins/default/default.css" />

... and CDATA scripts

#3. What else?

You can use plugin settings to add alternative path to an existing file or add a new file into the variable manually. The resulting output is saved in the "datas/cache/" folder and is returned compressed to a user. css-files from templates can be attached same way (see Installation for details).

#4. Installation

  1. Download and unzip the packed file into the plugins/ folder
  2. Add contents of plugins/combinator/.htaccess.txt into the .htaccess file in the root folder
  3. Install the Combinator plugin from within the admin panel
  4. In the plugin config area add path to your css located in the template folder "skins/default/default.css"
  5. Open header.tpl and delete/comment/move out of the HEADER block the line pointing to the style

#5. Назначение плагина

Плагин предназначен для соединения нескольких файлов .js/.css, которые передаются в переменной $out['compopup'] (system/header.php), для ускорения загрузки страницы.

#6. Принцип работы

Плагин получает значение переменной $out['compopup'], выбирает оттуда файлы javascript, css и CDATA. После обработки возвращает переменную $out['compopup'], содержащую в себе:

<script type="text/javascript" src="javascript/jquery.js,base.js,plugins/an_3DtagCloud/jvclouds3D/swfobject.js,jquery.form.js,jquery.effects.core.js"></script>
<link rel="stylesheet" type="text/css" href="style/plugins/tags/style.css,skins/default/default.css" />

... и скрипты, указанные через CDATA;

#7. Дополнительно

Также в настройках плагина можно указать альтернативный путь к существующему файлу или добавить новый файл в переменную вручную. Результаты обработки и соединения файлов сохраняются в папку "datas/cache/" и при входе отдаются пользователю в сжатом виде без обработки. Таким же образом можно подключать и css из шаблона (см. п.4, 5 раздела Установка).

#8. Установка

  1. Скачиваем и распаковываем в папку plugins/combinator
  2. Добавляем в файл .htaccess, расположенный в корне сайта, содержимое файла plugins/combinator/.htaccess.txt
  3. Переходим в "Панель администрирования", вкладка "Плагины", находим "Combinator", заходим в него и нажимаем "Установить"
  4. Заходим в настройки плагина и добавляем в поле "Альтернативные файлы css для кеширования и загрузки" адрес к вашему файлу css, расположенному в папке с вашим шаблоном "skins/default/default.css"
  5. Открываем в вашем шаблоне файл header.tpl и можем со спокойной совестью удалить/закоментировать/вынести за пределы "<!-- END: HEADER -->" строку, указывающую на стиль в вашем шаблоне

2. elfrenazo  23.10.2010 15:21
Estoy con el traductor web de ingles español, haber si soy capaz de ponerlo en mi web. Yo uso un pc como servidor web, me viene muy bien. Gracias!
Додавання комментарів доступно лише зареєстрованим користувачам