facuz / laravel-theme Goto Github PK
View Code? Open in Web Editor NEWTheme and asset managing for laravel
License: MIT License
Theme and asset managing for laravel
License: MIT License
Can I use Laravel Mix with this repo ?
the interface Facuz\Theme\Contracts\Theme
is empty, its not so friendly to IDE users
Hello,
i saw in the original repo the following pull request: teepluss/laravel-theme#122
it would be nice if you could integrate the thing here. :)
Hi just wondering if there's any chance for you to switch to opis/closure?
jeremeamia/superclosure is no longer maintained.
Thank you
How can I pass variables in layouts\layout.blade.php?
Eg: I want to pass variable in title
Hi,
Not sure if we're doing something wrong, but all the theme files are stored in /public. This means that you can view the source code in the blade files by navigating to them (e.g. http://demo.local/themes/default/layouts/layout.blade.php where demo.local is my test site name)
This doesn't seem great. Is this easily fixable?
Hi,
I'm using Laravel 7 and when I run php artisan config:cache
command I get the following error:
In ConfigCacheCommand.php line 71:
Your configuration files are not serializable.
In config.php line 660:
Call to undefined method Opis\Closure\SerializableClosure::__set_state()
I believe this is coming from your package.
After looking on the net, most answers point to this solution.
1) Delete the file bootstrap/cache/config.php
But this file doesn't exist in my project so I can't delete it.
Any idea how to fix this?
Hello i have in assets... style.css color.css and plugins.css... scripts.js and plugins.js
$asset->themePath()->add([
['style', 'css/style.css'],
['script', 'js/scripts.js']
]);
how can add to this?
This is my view file
@extends('user/app')
@section('bg-img',Storage::disk('local')->url($post->image))
@section('title',$post->title)
@section('subheading',$post->subtitle)
@section('head')
<link rel="stylesheet" type="text/css" href="{{asset('user/css/prism.css') }}">
@endsection()
@section('main-content')
<!-- Post Content -->
<!--1st facebook comment start-->
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v4.0&appId=380768179271978&autoLogAppEvents=1"></script>
<!-- end commnets fb-->
<article>
<div class="container">
<div class="row">
<div class="col-lg-8 col-offset-2 col-md-10 mx-auto">
<small>Created at {{ $post->created_at->diffForHumans() }}</small>
@foreach($post->categories as $category)
<small class=" float-right" style="margin-right: 20px">
<a href="{{ route('category',$category->slug) }}">{{ $category->name }}</a>
</small>
@endforeach()
{!! htmlspecialchars_decode($post->body) !!}
<!--Tag cloud.-->
<h3>Tags clouds</h3>
@foreach($post->tags as $tag)
<a href="{{ route('tag',$tag->slug) }}"><small class="float-left" style="margin-right: 20px;border-radius: 5px;border: 1px solid gray;padding: 5px">
{{ $tag->name }}
</small></a>
@endforeach()
</div>
<!--2nd comment scripts-->
<div class="fb-comments" data-href="{{ Request::url() }}" data-width="" data-numposts="5"></div>
</div>
</div>
</article>
<hr>
@endsection()
@section('footer')
<script src="{{ asset('user/js/prism.js') }}"></script>
@endsection()
And this my layout file under themes directory
<!DOCTYPE html>
<html lang="en">
<head>
@partial('head')
@styles()
</head>
<body>
@partial('header')
@section('main-content')
@show
@partial('footer')
@scripts('footer')
</body>
</html>
Issue with direct asset path , Url should not start with /public , resulting in 404 for assets.
Please suggest .
Input
<img src="{{ Theme::asset()->url('images/running-bnr.jpg') }}" alt="">
Output
<img src="/public/themes/default/assets/images/running-bnr.jpg" alt="">
Please also note : Adding assets through config is fine .
Input
$asset->themePath()->add([['style', 'css/style.css']]);
Output
<link media="all" type="text/css" rel="stylesheet" href="http://newps.in/themes/default/assets/css/style.css">
Config :
'assetUrl' => env('APP_ASSET_URL', '/'),
/*
|--------------------------------------------------------------------------
| Theme Default
|--------------------------------------------------------------------------
|
| If you don't set a theme when using a "Theme" class
| the default theme will replace automatically.
|
*/
'themeDefault' => env('APP_THEME', 'default'),
/*
|--------------------------------------------------------------------------
| Layout Default
|--------------------------------------------------------------------------
|
| If you don't set a layout when using a "Theme" class
| the default layout will replace automatically.
|
*/
'layoutDefault' => env('APP_THEME_LAYOUT', 'layout'),
/*
|--------------------------------------------------------------------------
| Path to lookup theme
|--------------------------------------------------------------------------
|
| The root path contains themes collections.
|
*/
'themeDir' => env('APP_THEME_DIR', 'public/themes'),
Hi,
How can I compile the gulpfile.js within the themes? I don't see in the docs how to do this.
php artisan theme:widget default
Illuminate\Contracts\Filesystem\FileNotFoundException : File does not exist at path
at /Users/teeoo/Desktop/VueBlog/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:41
37| if ($this->isFile($path)) {
38| return $lock ? $this->sharedGet($path) : file_get_contents($path);
39| }
40|
41| throw new FileNotFoundException("File does not exist at path {$path}");
42| }
43|
44| /**
45| * Get contents of a file with shared access.
Exception trace:
1 Illuminate\Filesystem\Filesystem::get()
/Users/teeoo/Desktop/VueBlog/vendor/facuz/laravel-themes/src/Commands/WidgetGeneratorCommand.php:192
2 Facuz\Theme\Commands\WidgetGeneratorCommand::getTemplate("widgetClass")
/Users/teeoo/Desktop/VueBlog/vendor/facuz/laravel-themes/src/Commands/WidgetGeneratorCommand.php:79
Please use the argument -v to see more details.
How to use @each('blog.item', $posts, 'post') in master blade or in layout blade
after migrate from teepluss\theme to FaCuZ/laravel-theme, in script
{!! Theme::asset()->container('footer')->usePath()->add('app', 'js/app.js') !!}
i get error:
"Object of class Facuz\Theme\AssetContainer could not be converted to string (View: D:\WWW\barlin\public\themes\default\views\landing.blade.php)"
then result in dd:
AssetContainer {#5927 ▼
+usePath: true
+path: null
+name: "footer"
+"assets": array:1 [▼
"script" => array:1 [▼
"app" => array:3 [▼
"source" => "public/themes/default/assets/js/app.js"
"dependencies" => []
"attributes" => []
]
]
]
}
whats wrong this script?
laravel 6 have this issue
call to undefined function facuz\theme\array_get()
IN AssetContainer.php
$type = (pathinfo($source, PATHINFO_EXTENSION) == 'css') ? 'style' : 'script';
This line is causing issue if i pass version in source.
Is there anyway to add versioning to asstes in Facuz.
Is there anyway i can achive versioning like below.
$asset->themePath()->add([
['style', 'css/style.css?v=6666666'],
['script', 'js/script.js?v=888888']
]);
Because someone noticed that we instantiate an abstract class Widget in ThemeServiceProvider.
I think thats not right.... Or i'am stupid??
I have SEO Tools and im calling
$this->seo()->setTitle('My site title');
but the title doesn't update, i dont have any $theme->setTitle()
in my code
I have two views.
Example:
views
applications
create.blade.php
form.blade.php
How can I load form.blade.php in create.blade.php
My create.blade.php code is here
{!! Form::open(array('route' => 'restaurant.store','method'=>'POST')) !!}
@include('restaurant.form');
{!! Form::close() !!}
This throws the following error.
View [restaurant.form] not found. (View: /var/www/works/public/themes/default/views/restaurant/form.blade.php)
Is there any ways to load another view.
How can add a external css or js like:
Illuminate\Contracts\Filesystem\FileNotFoundException : File does not exist at path
at /Users/teeoo/Desktop/Teeoo/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:41
37| if ($this->isFile($path)) {
38| return $lock ? $this->sharedGet($path) : file_get_contents($path);
39| }
40|
41| throw new FileNotFoundException("File does not exist at path {$path}");
42| }
43|
44| /**
45| * Get contents of a file with shared access.
Exception trace:
1 Illuminate\Filesystem\Filesystem::get()
/Users/teeoo/Desktop/Teeoo/vendor/facuz/laravel-themes/src/Commands/WidgetGeneratorCommand.php:191
2 Facuz\Theme\Commands\WidgetGeneratorCommand::getTemplate("widgetClass")
/Users/teeoo/Desktop/Teeoo/vendor/facuz/laravel-themes/src/Commands/WidgetGeneratorCommand.php:79
Please use the argument -v to see more details.
Hi,
I have a question.
Is there a way to delete a theme, running Artisan command programmatically?
Something like this:
Route::post('themes/destroy_theme/{theme}', ['as' => 'destroy_theme'], function () { Artisan::call('theme:destroy', ['name' => '{theme}']); return redirect('admin/themes/'); });
Regards,
Martin
I used this module to report the following error:
ErrorException (E_ERROR)
Undefined index: content (View: /home/www/lianghongbo-v2019/public/themes/default/layouts/layout.blade.php)
Previous exceptions
Undefined index: content (0)
How to solve this problem ?
Hello, i installed this package in Laravel 5.8 but not work for me, not detect Aliases Theme and with "use Facuz\Theme\Facades\Theme;" i get "Class theme does not exist". I can how fix? Thanks!
$path appears to be undefined when calling the Theme::all() command.
hello any can help me?
this work correctly (direct in blade)
return view('index')->with('posts',$post)->with('recent_posts',$rcnt_post);
but with themes no work (with laravel-theme)
return Theme::view('index')->with('posts',$post)->with('recent_posts',$rcnt_post);
I want to use this package in a multiple users environment, where every user can select a different theme for his personal piece of website. Is this usecase supported, or is the global namespace variable an obstacle to that? I can't quite determine.
Thanks for your time!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.