CodeIgniter – where to store css,js,fonts and images?

I have the set up like this.

  • application
  • assets
    • css
    • js
    • images
    • fonts

Then inside the folder applications/helpers/ I created the file utility_helper.php with the following code.

function asset_url(){
return base_url().'assets/';
}

Then inside application/cofig/autoload.php I have added the following code


$autoload['helper'] = array('url','utility');

Now this echo asset_url(); is the path to css, js,fonts and image files.

Leave a Reply