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:
[syntax=text]Fatal error: Class 'Assetic\Asset\AssetCollection' not found in /var/www/newnew/test.php on line 9[/syntax]

My directory structure is as followed
[syntax=text]www
-- test.php
-- assets
-- -- css
-- -- -- styles.css[/syntax]

My test script is:
[syntax=php]<?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();
?>[/syntax]
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:
[syntax=text]Fatal error: Class 'Assetic\Asset\AssetCollection' not found in /var/www/newnew/test.php on line 9[/syntax]

My directory structure is as followed
[syntax=text]www
-- test.php
-- assets
-- -- css
-- -- -- styles.css[/syntax]

My test script is:
[syntax=php]<?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();
?>[/syntax]

try saving the class on a new php file called "whatever.class.php" then use [syntax=php]require("whatever.class.php"); [/syntax]You could also try [syntax=php]include("whatever.class.php");[/syntax]
Post Reply