![]() |
Yet another Asset Library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Yet another Asset Library (/showthread.php?tid=7067) |
Yet another Asset Library - El Forum - 03-23-2008 [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 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/" Yet another Asset Library - El Forum - 03-23-2008 [eluser]Kemik[/eluser] Thanks for using CI Base ![]() Yet another Asset Library - El Forum - 03-23-2008 [eluser]trice22[/eluser] Sure thing! It's a nice piece of work and I like the idea. Thanks for that. —trice |