rainlab / livewire-plugin Goto Github PK
View Code? Open in Web Editor NEWIntegrate Laravel Livewire components inside October CMS themes.
License: Other
Integrate Laravel Livewire components inside October CMS themes.
License: Other
Tried to use Livewire 3 with this plugin but I've found a couple of issues:
If it helps I can make a pull request for the first two items, the way I maintained compatibility with v2 is checking if the old classes still exists, like this:
public static function renderStyles($options = [])
{
if (method_exists('\Livewire\LivewireManager', 'styles')) {
return Livewire::styles($options);
}
return \Livewire\Mechanisms\FrontendAssets\FrontendAssets::styles($options);
}
public static function renderScripts($options = [])
{
$turboScript = Url::asset('plugins/rainlab/livewire/assets/js/livewire-turbo.js');
if (method_exists('\Livewire\LivewireManager', 'scripts')) {
if (!isset($options['asset_url'])) {
$options['asset_url'] = Url::asset('');
}
$scriptStr = Livewire::scripts($options);
} else {
$scriptStr = \Livewire\Mechanisms\FrontendAssets\FrontendAssets::scripts($options);
}
$scriptStr = str_replace('data-turbolinks-eval="false"', '', $scriptStr);
$scriptStr .= "<script> addEventListener('page:loaded', function() { if (window.oc && oc.useTurbo && oc.useTurbo() && !window.Livewire) window.location.reload(); }, { once: true }); </script>";
$scriptStr .= '<script src="' . $turboScript . '" data-turbo-eval="false"></script>';
return $scriptStr;
}
if (method_exists('\Livewire\LivewireManager', 'setScriptRoute')) {
Livewire::setScriptRoute(function ($handle) {
return Route::get(Url::asset('/livewire/livewire.js'), $handle);
});
}
if (class_exists('\Livewire\LifecycleManager')) {
$compiler
->write(")->html();\n");
} else {
$compiler
->write(");\n");
}
I noticed that the component isn’t found unless the app/Livewire folder is written with a capital L, instead of lowercase as it is written in the first mention of the readme file.
I have a 404 error on the livewire script js (so it doesn’t work). In my case OC is installed in a subfolder, and even if I set the link policy to force, its trying to get the file without taking into account the whole path with the subfolder in it.
The script is added like this (without the whole path):
<script src="/livewire/livewire.js?id=90730a3b0e7144480175" data-turbo-eval="false" data-turbolinks-eval="false" ></script>
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.