Welcome Guest, Not a member yet? Register   Sign In
How to add CSS and JS to Codeigniter application
#1

[eluser]barun the michael[/eluser]
HI All


Could any one help me out regarding how to add CSS and JS to a Codeigniter application.
Please help........
#2

[eluser]thinkigniter[/eluser]
Checkout this library...
AssetLibPro
http://ellislab.com/forums/viewthread/78931/

Nice library to make adding css and js easy...
#3

[eluser]young[/eluser]
did you use the correct path? the root path is your document root in apache
#4

[eluser]Colin Williams[/eluser]
Code:
<style type="text/css">@import "/path/to/file.css"</style>

Code:
<scr1pt src="/path/to/file.js"></scr1pt>

Put those tags in the &lt;head&gt; tag and make sure the paths are correct. Remember, paths are relative to the URL, not your view's file location on the server.
#5

[eluser]Stefano G[/eluser]
Hi, I put my css, js and images at root level (outside the CI folders)

Code:
/-+-- [document root]
   |
   +----- [css]
   |
   +----- [images]
   |  
   +----- [javascripts]
   |
   +--+-- [system]
      |
      +---- [application]

and then refer to all them as simply as

Code:
&lt;link rel="stylesheet" href="/css/screen.css" media="screen,projection" type="text/css" /&gt;



and so on... but probably this is not what you meant in your answer... :p

Cheers!

Stefano
#6

[eluser]tonydewan[/eluser]
I just released an asset management library called Carabiner. It might make managing your CSS/JS easier. Check it out.




Theme © iAndrew 2016 - Forum software by © MyBB