1. Go to this page and download the library: Download iturgeon/qasset library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iturgeon / qasset example snippets
return [
// Reduces groups with the same name down to one
// 'remove_group_duplicates' => true, // default = true
// define paths shortcuts like Casset does
'paths' => [
'gfonts' => '//fonts.googleapis.com/',
'theme' => '/themes/'.Config::get('theme.active', 'default').'/assets/css/',
'assets' => '/assets/css'
],
// groups to always load, and where to place them
'always_load_groups' => [
// default placement
'default' => [
'main', // groups
'fonts',
],
// custom footer placement (more useful for js then it would be css!)
'footer' => [
'angular' // group
]
],
'groups' => [
// group is in the always_load_groups above, inserted into the default placement
'fonts' => [
// same as: '//fonts.googleapis.com/css?family=AWESOMEFONT:400,700,900'
'gfonts::css?family=AWESOMEFONT:400,700,900'
],
// group is in the always_load_groups above, inserted into the default placement
'main' => [
'theme::site.css',
'theme::normalize.min.css',
],
'homepage' => [
'theme::homepage.css',
],
],
// Change the precalulated hash config file name, defaults to 'asset_hash.json'
// Supports any fuelphp config format
'hash_file' => 'asset_hash.json'
];
public function action_index()
{
// insert the javascript group 'homepage' (defined in js.php config) into the footer placement
Js::push_group('homepage', 'footer');
// adds a script directly w/o using groups, send an array of scripts if you want
Js::push('theme::homepage.min.js');
// adds inline javascript to the footer
Js::push_inline('var CONST = true;', 'footer');
// Css works the same way as Js
Css::push_group(['homepage', 'holiday']); // you can send arrays!
Css::push(['theme::one.css', 'theme::two.css']); // more arrays here
Css::push_inline('div.total-mistake{ display:none; }'); // for those last minute monkey patches
$theme = Theme::instance();
$theme->set_template('layouts/homepage')
->set('title', 'Welcome to the Magic Show');
return Response::forge($theme);
}
<!DOCTYPE html>
<html>
<head>
<title><?= $title
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.