title: How to include css and js files (Codeigniter + Twig)
body: <p>im new in the forum and im spanish... sorry for my low level of english...</p>
  
  <p>Im using Codeigniter with twig engine in my project but I having some problems...</p>
  
  <p>When I use:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="{{ asset('assets/css/bootstrap.min.css') }}"&gt;
  </code></pre>
  
  <p>Codeigniter throws an exception. It says:</p>
  
  <blockquote>
    <p>The function "asset" does not exist. Did you mean "assert" in "index.html.twig" at line 12 --- #0 /volume1/web/ci/application/libraries/Twig/ExpressionParser.php(351): Twig_ExpressionParser->getFunctionNodeClass('asset', 12) #1 /volume1/web/ci/application/libraries/Twig/ExpressionParser.php(144): Twig_ExpressionParser->getFunctionNode('asset', 12) #2 /volume1/web/ci/application/libraries/Twig/ExpressionParser.php(84): Twig_ExpressionParser->parsePrimaryExpression() #3 /volume1/web/ci/application/libraries/Twig/ExpressionParser.php(41): Twig_ExpressionParser->getPrimary() #4 /volume1/web/ci/application/libraries/Twig/Parser.php(141): Twig_ExpressionParser->parseExpression() #5 /volume1/web/ci/application/libraries/Twig/TokenParser/Block.php(45): Twig_Parser->subparse(Array, true) #6 /volume1/web/ci/application/libraries/Twig/Parser.php(187): Twig_TokenParser_Block->parse(Object(Twig_Token)) #7 /volume1/web/ci/application/libraries/Twig/Parser.php(95): Twig_Parser->subparse(NULL, false) #8 /volume1/web/ci/application/libraries/Twig/Environment.php(543): Twig_Parser->parse(Object(Twig_TokenStream)) #9 /volume1/web/ci/application/libraries/Twig/Environment.php(595): Twig_Environment->parse(Object(Twig_TokenStream)) #10 /volume1/web/ci/application/libraries/Twig/Environment.php(335): Twig_Environment->compileSource('...', 'index.html.twig') #11 /volume1/web/ci/application/libraries/Twig.php(90): Twig_Environment->loadTemplate('index.html.twig') #12 /volume1/web/ci/application/controllers/welcome.php(15): Twig->display('index.html.twig', Array) #13 [internal function]: Welcome->index() #14 /volume1/web/ci/system/core/CodeIgniter.php(360): call_user_func_array(Array, Array) #15 /volume1/web/ci/index.php(202): require_once('/volume1/web/ci...') #16 {main}</p>
  </blockquote>
  
  <p>Also throws an exception for any function twig</p>
  
  <p>What is the problem?</p>
  
  <p>Thank you!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Ok guys, I haven't been unable to resolve my problem, the function doesn't exists but I have got to include my css and js files and also using twig together. The problem was on my .htaccess file (the file is on root directory in my server). The file had written:</p>
  
  <pre><code>RewriteEngine on
  RewriteCond $1 !^(index.php|css|js|images|robots.txt) 
  RewriteRule ^(.*)$ /ci/index.php/$1 [L]
  </code></pre>
  
  <p>So I created another .htaccess file on "/ci/assets/.htaccess" with this code:</p>
  
  <pre><code>RewriteEngine off
  RewriteCond $1 !^(index.php|css|js|images|robots.txt) 
  RewriteRule ^(.*)$ /ci/index.php/$1 [L]
  </code></pre>
  
  <p>I don't know if this is the best way but this is valid for me and I can work fine.</p>
  
  <p>Any sugestion?</p>