Page 1 of 1

Assetic

Posted: Sun Mar 31, 2013 11:52 pm
by FrederickGeek8
I am trying to use this PHP library that allows me to manage assets. Now I have no idea how to install it...
LINK: https://github.com/kriswallsmith/assetic

Now I have used the instructions posted here but when I try to run my test script I get:
Fatal error: Class 'Assetic\Asset\AssetCollection' not found in /var/www/newnew/test.php on line 9
My directory structure is as followed
www
-- test.php
-- assets
-- -- css
-- -- -- styles.css
My test script is:
<?php

use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use Assetic\Asset\GlobAsset;
use Assetic\Filter\LessFilter;
use Assetic\Filter\Yui;

$css = new AssetCollection(array(
    new GlobAsset('assets/css/*'),
), array(
    new Yui\CssCompressorFilter('core/lib/yuicompressor-2.4.7.jar'),
));

echo $css->dump();
?>

Re: Assetic

Posted: Sun Jun 02, 2013 6:22 am
by killfrog47
FrederickGeek8 wrote:I am trying to use this PHP library that allows me to manage assets. Now I have no idea how to install it...
LINK: https://github.com/kriswallsmith/assetic

Now I have used the instructions posted here but when I try to run my test script I get:
Fatal error: Class 'Assetic\Asset\AssetCollection' not found in /var/www/newnew/test.php on line 9
My directory structure is as followed
www
-- test.php
-- assets
-- -- css
-- -- -- styles.css
My test script is:
<?php

use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use Assetic\Asset\GlobAsset;
use Assetic\Filter\LessFilter;
use Assetic\Filter\Yui;

$css = new AssetCollection(array(
    new GlobAsset('assets/css/*'),
), array(
    new Yui\CssCompressorFilter('core/lib/yuicompressor-2.4.7.jar'),
));

echo $css->dump();
?>
try saving the class on a new php file called "whatever.class.php" then use
require("whatever.class.php"); 
You could also try
include("whatever.class.php");