All Assets must be located in the public
directory. Within that directory you can use any folder structure you might want to use eg. public/path-to-theme/etc
.
There might be an other solution (didn't test it), but its a bit messy.
You could create an AssetsController
and in that controller load the files based on the template settings. I'm not sure how your situation is exactly but I can immagine the following. A user has a preference for a theme (stored in the users table in the DB). In app.php
you could create a template
config variable. The value of this variable is the default theme that will be used if not a specific theme is set (by the user for example or based on an input field or get parameter (or whatever)).
array(
'theme' => 'default',
),
In the AssetsController you cold create a getCss action and load the theme corrosponding to the css you need:
public function getCss() {
$theme = Config::get('app.theme');
return file_get_contents($theme.'/stylesheet.css');
}
Inside routes.php
you create the following route
Route::get('stylesheet.css', array('uses' => 'AssetsController@getCss'));
To load your css in your view file you add this:
<link rel="stylesheet" href="{{ URL::action('AssetsController@getCss') }}">
This works for the default theme. If you want to load the user specific theme preferences you can do that in a filter (filters.php
), for example in the auth filter or a custom filter in filters.php (you should append that filter name to the original routes of the pages you want to display).
Route::filter('auth', function()
{
Config::set('app.theme', Auth::user()->theme);
});
This only works if the user is logged in. But in a different filter you could check if a different parameter is set (an get, post or session variable for example).
Hope this might help.