-
Notifications
You must be signed in to change notification settings - Fork 38
Basic Usage
CSS-JS-Booster is – as its name implies – divided into two function blocks:
A CSS-optimizing block and a JavaScript-optimizing block.
For both functionalities you first need to copy the booster-folder with all its files
into your website project. Then go into the booster-folder and create a subfolder there
named booster_cache and have it CHMOD 0777 so that anybody has write-permission.
Afterwards include
<?php
include('booster/booster_inc.php');
$booster = new Booster();
?>
at the top of your (PHP-interpreted) file that you want to load faster.
(Adjust the path above according to your folder-structure)
Should you happen to only have static HTML-files, try enabling PHP-parsing
by putting a .htaccess-file into the site’s root with following directive:
AddType application/x-httpd-php .html .htm
For the CSS-part, put all releveant CSS-files into a subfolder css of your
site. Make sure, all declarations pointing to image-files have their paths
adjusted (i.e. all CSS should be fully functional by themselves inside that
folder).
If you have multiple CSS-files rename them so that they are alphabetically
sorted in the desired order, e.g.:
01_first.css
02_second.css
03_third.css
Then add this declaration in the HTML’s head-section:
<?php
$booster->css_source = '../css'; //relative path from inside booster folder
echo $booster->css_markup();
?>
for example:
<head>
<title>Webpage</title>
<?php
$booster->css_source = '../css'; //relative path from inside booster folder
echo $booster->css_markup();
?>
</head>
The argument is the path relativ to CSS-JS-Booster’s folder.
You find more advanced usage-techniques in section Advanced Usage – which also helps if you already have a fixed site-structure and cannot mess with it.
For the JS-part, put all releveant JS-files into a subfolder js of your
site.
If you have multiple JS-files rename them so that they are alphabetically
sorted in the desired order, e.g.:
01_first.js
02_second.js
03_third.js
Then add this declaration either in the HTML’s head-section, or – better for
performance and therefore recommended when you experience no errors – right
before the closing