2
What is the appropriate location to allocate libraries and plugins Javascript
and CSS
in Cakephp 3, as there has been a major change in the directory structure from this release to earlier.
All files .js
and .css
has a specific and separate location.
All file calls are made this way ():
<?= $this->Html->css('style.css') ?>
<?= $this->Html->script('main.js',['defer' => true]) ?>
Soon it is possible to notice that there is presumption of the directory where the files are.
Directory structure (I took prints to see 100% of the structure and what is inside each):
OBS: Plugins and Libraries like Jquery, Jquery-ui and Bootstrap have folders and subfolders, font files, icons, images, javascript and css.
Usually the front end goes on public, www, webroot and so on.
– gmsantos
@gmsantos and what would be the references?
– Ricardo
Cakephp does this by rewriting
.htaccess
. Probably,css/default.css
would point toapp/webroot/css/default.css
– Wallace Maxters
@I don’t know the methods
Html->css()
cake, when I get a little time here, I’ll look it up on the Docs. What I do is map in apache the webroot folder as root and in the files reference the relative path, which would be css/default.css– gmsantos