0

I have laravel 5 and config file in the config folder and My css located in the resources folder which is a same level with public folder where located index.php. Virtual Host Apache config looks to the public folder as a root site directory, but in this situation I cannot declare correct path from /public/index.php to the resources folder.

From one side I can try easy way and just relocate public folder into root of the laravel, but I don't like this way, any ideas?

Zimm i48
  • 2,901
  • 17
  • 26
Nesquik27
  • 234
  • 1
  • 7
  • 18

2 Answers2

1

Use resource_path('path/to/your/css')

https://laravel.com/docs/5.3/helpers#method-resource-path

EDIT

The most logical is to include your stylesheets in your public folder though. If you need to style a page, the style is public anyway. So why not put in the public folder. There's 2 options to do this:

  1. Do it manually by just copying/moving the files
  2. Use an automated tool like Gulp or Laravel's own Elixir, which provides a really easy way to copy your assets.
Loek
  • 4,037
  • 19
  • 35
  • No problem! Please tag as an answer so other people can benefit :) – Loek Jan 13 '17 at 14:53
  • 1
    The files are still not publicly available thought. You won't be able to load the, say, styles in a view if you don't have them in public directory. The idea behind the resources folder is that you have editable CSS/SASS/JS files there, which are then compiled into a single minified file with gulp script. – DevK Jan 13 '17 at 14:56
  • Updated my answer – Loek Jan 13 '17 at 15:02
0

add this code in public/index.php

$app->bind('path.public', function() {
     return __DIR__;
});