Пример #1
0
 public function testURLModifier()
 {
     $style = 'modules/asset/assets/style.removethis.css';
     $script = 'modules/asset/assets/script.removethis.js';
     Assets::css($style);
     Assets::js($script);
     $only_style = \BuboBox\Assets::render(false, true, function ($style) {
         return str_replace('.removethis', '', $style);
     });
     $only_script = \BuboBox\Assets::render(true, false, function ($script) {
         return str_replace('.removethis', '', $script);
     });
     $this->assertNotContains('removethis', $only_style, 'Should not contain removethis part');
     $this->assertNotContains('removethis', $only_script, 'Should not contain removethis part');
 }
Пример #2
0
 * Something that is a common practice in web development is loading your CSS files in the header
 * and your javascript files in the footer. 
 * This example shows you how that is done
 */
include "bootstrap.php";
include "assets.php";
// In your controller.php
use BuboBox\Assets;
Assets::js('modules/asset/assets/script.js');
Assets::css('modules/asset/assets/style.css');
// In your view.php
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Assets example</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">
        <?php 
echo Assets::render(false, true);
?>
    </head>
    <body>
    	<p>Hello world!</p>
        <?php 
echo Assets::render(true, false);
?>
    </body>
</html>
Пример #3
0
<?php

include "bootstrap.php";
include "assets.php";
// In your controller.php
use BuboBox\Assets;
Assets::css('modules/asset/assets/style1.css');
Assets::css('modules/asset/assets/style2.css');
// In your view.php
echo Assets::render(false, true);