I've created this library to make easy using css or js files with views/templates.
Its use it is very easy, although with a template it is more useful.
descripción en español
How it works
This library find css/js files with same name that controller and view, and load these files (if exists):
- controller.css
- controller_view.css
- controller.js
- controller_view.js
You only add the file/s in the corresponding directory, and the library loads automatically it. ¿Easy no?
Configuration
You can configure directory names in config.php file:
$config['assets_dir'] = 'pub'; //Default is pubNote: assets_css_dir and assets_js_dir works into assets_dir directory
$config['assets_css_dir'] = 'css'; //Default is css
$config['assets_js_dir'] = 'js'; //Default is js
So the file structure would see like this:
/pubNote: Don't forget create directories.
/pub/css
/pub/js
Calling to the Library
In view/template into '<'head'>' tag add this code:
'<'?php Autoload_assets::get();?'>'
I hope it will be useful.
Download Codeigniter Assets
Help to use libraries here
No comments:
Post a Comment