Using theme with Laravel

Asked

Viewed 460 times

1

Well, I need to use a theme but I’m not understanding where to put the files, besides this I’m having problems with the import of css files, actually the files I’m putting inside views. My folder structures are as follows:

-resources
-css
-errors
-fonts
-img
-less
-media
-vendor
-vendors
-index.blade.php (Pagina index onde tem o html base)
-meio.blade.php (Pagina onde tem o conteúdo da pagina principal.)

I am importing the files as follows on the index.blade.php page`

 <link href="/../resources/views/vendors/bower_components/animate.css/animate.min.css" rel="stylesheet">

The mistake you’re making is this console.log browser:

Failed to load Resource: the server responded with a status of 404 (Not Found)

How should my folder structures look to recognize css, and to better divide the project ?

2 answers

2


Files of this type are only accessible within the public folder.

Put your files inside the public folder, for example:

public/css
public/images
public/fonts
public/js

Then you can call them inside your views, so:

{{ HTML::script('js/animate.css/animate.min.css'); }}

{{ HTML::style('css/style.css'); }}

The ideal is to compress and minimize these files in a single, thus decreasing the amount of requests that the browser makes to search the dependencies of your site increasing the speed of loading it.

The Laravel already comes with the integrated Laravel-elixir, which facilitates these types of tasks, I recommend that you see the official documentation on this subject.

1

Studying a little understood that css files, img, among others, that are part of a structure should be on the public part, because these will be the data that will be actually published.

After doing this I can use all my layout normally.

So the ideal is:

Files with css/js/img folders should be on the public page of the project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.