Assetic

Ask about a PHP problem here.
Post Reply
User avatar
FrederickGeek8
Posts: 148
Joined: Wed Nov 30, 2011 10:31 pm

Assetic

Post 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();
?>
User avatar
killfrog47
Posts: 106
Joined: Tue Mar 12, 2013 2:52 am
Location: Tempe, AZ
Contact:

Re: Assetic

Post 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");
Post Reply