Welcome Guest, Not a member yet? Register   Sign In
Yet another Asset Library
#1

[eluser]trice22[/eluser]
Hello,

I was in the need of a way to handle my assets (CSS, JS, META and other) and the existing possibilities didn't really provide what I was looking for—so I wrote/extended my own, based on Ted Wood's ViewLib. It's nothing exiting or new, but I figured someone might find it useful:

It features:
* Link CSS (single file and array) with option for conditional comments
* Import CSS (single file and array)
* Link JS (single file and array)
* META-tags
* additional data (e.g. set JS-variables etc.)

Setting value:
Code:
$this->assets->linkCSS('some_styles.css', 'screen');

Retrieving value in view:
Code:
// returns all css-files (linked, imported and including conditional comments
$this->assets->getAssets('css');

This has the advantage (for me), that I can e.g. easily set META-tags individually for each page, which helps with SEO.

Well, you'll find everything you need in the code.

Happy Easter,
—trice

P.S.: As in Michael Wales' asset–helper, this lib assumes that you're storing your files in e.g. "assets/css/"
#2

[eluser]Kemik[/eluser]
Thanks for using CI Base Big Grin
#3

[eluser]trice22[/eluser]
Sure thing! It's a nice piece of work and I like the idea. Thanks for that.
—trice




Theme © iAndrew 2016 - Forum software by © MyBB