Remove orchestra/asset, using our our blade now
This commit is contained in:
parent
dd64cba897
commit
ca99748361
@ -11,8 +11,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"igaster/laravel-theme": "^2.0.17",
|
"igaster/laravel-theme": "^2.0.17",
|
||||||
"creativeorange/gravatar": "^1.0",
|
"creativeorange/gravatar": "^1.0"
|
||||||
"orchestra/asset": "^6.0"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
},
|
},
|
||||||
@ -27,7 +26,8 @@
|
|||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
"Leenooks\\Providers\\LeenooksServiceProvider"
|
"Leenooks\\Providers\\LeenooksServiceProvider",
|
||||||
|
"Leenooks\\Providers\\CustomBladeServiceProvider"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
77
src/Providers/CustomBladeServiceProvider.php
Normal file
77
src/Providers/CustomBladeServiceProvider.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Leenooks\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class CustomBladeServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bootstrap services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
Blade::directive('css',function(string $expression,array $args=[]) {
|
||||||
|
$html = '';
|
||||||
|
|
||||||
|
switch (trim($expression,"'")) {
|
||||||
|
case 'datatables':
|
||||||
|
return
|
||||||
|
'<link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.min.css" media="screen">'.
|
||||||
|
'<link type="text/css" rel="stylesheet" href="'.asset('plugin/dataTables/dataTables.bootstrap5.css').'" media="screen">';
|
||||||
|
|
||||||
|
case 'select2':
|
||||||
|
return
|
||||||
|
'<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css">';
|
||||||
|
|
||||||
|
case 'simplemde':
|
||||||
|
return
|
||||||
|
'<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">';
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new \Exception('Unknown CSS: '.$expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
});
|
||||||
|
|
||||||
|
Blade::directive('js',function($expression) {
|
||||||
|
$html = '';
|
||||||
|
|
||||||
|
switch (trim($expression,"'")) {
|
||||||
|
case 'datatables':
|
||||||
|
return
|
||||||
|
'<script type="text/javascript" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="'.asset('plugin/dataTables/dataTables.conditionalPaging.js').'"></script>'.
|
||||||
|
'<script type="text/javascript" src="https://cdn.datatables.net/rowgroup/1.1.2/js/dataTables.rowGroup.min.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap5.min.js"></script>';
|
||||||
|
|
||||||
|
case 'highcharts':
|
||||||
|
return
|
||||||
|
'<script type="text/javascript" src="https://code.highcharts.com/highcharts.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/data.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/drilldown.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/exporting.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/export-data.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="https://code.highcharts.com/themes/dark-unica.js"></script>';
|
||||||
|
|
||||||
|
case 'select2':
|
||||||
|
return
|
||||||
|
'<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>'.
|
||||||
|
'<script type="text/javascript" src="'.asset('plugin/select2/fix-autofocus.js').'"></script>';
|
||||||
|
|
||||||
|
case 'simplemde':
|
||||||
|
return
|
||||||
|
'<script type="text/javascript" src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>';
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new \Exception('Unknown JS: '.$expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user