Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x][WIP] Bassets 🐶 #4815

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,487 changes: 1 addition & 8,486 deletions mix-manifest.json

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/config/backpack/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@
// 'packages/noty/noty.css',
tabacitu marked this conversation as resolved.
Show resolved Hide resolved

// Load the fonts separately (so that you can replace them at will):
'packages/source-sans-pro/source-sans-pro.css',
'packages/line-awesome/css/line-awesome.min.css',
['https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,400;0,600;0,700;1,400&display=swap', true, [], 'style'],
tabacitu marked this conversation as resolved.
Show resolved Hide resolved

'https://cdnjs.cloudflare.com/ajax/libs/line-awesome/1.3.0/line-awesome/css/line-awesome.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/line-awesome/1.3.0/line-awesome/fonts/la-regular-400.woff2',
'https://cdnjs.cloudflare.com/ajax/libs/line-awesome/1.3.0/line-awesome/fonts/la-solid-900.woff2',
'https://cdnjs.cloudflare.com/ajax/libs/line-awesome/1.3.0/line-awesome/fonts/la-brands-400.woff2',

// Example (the fonts above, loaded from CDN instead)
// 'https://maxcdn.icons8.com/fonts/line-awesome/1.1/css/line-awesome-font-awesome.min.css',
Expand Down
4 changes: 2 additions & 2 deletions src/resources/views/base/inc/getting_started.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ protected function setupUpdateOperation()
</div>

@push('after_styles')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/base16/dracula.min.css">
@basset('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/base16/dracula.min.css')
@endpush

@push('after_scripts')
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js"></script>
@basset('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js')
<script>hljs.highlightAll();</script>
@endpush
13 changes: 5 additions & 8 deletions src/resources/views/base/inc/head.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

@if (config('backpack.base.styles') && count(config('backpack.base.styles')))
@foreach (config('backpack.base.styles') as $path)
<link rel="stylesheet" type="text/css" href="{{ asset($path).'?v='.config('backpack.base.cachebusting_string') }}">
@if(is_array($path))
@basset(...$path)
@else
@basset($path)
@endif
tabacitu marked this conversation as resolved.
Show resolved Hide resolved
@endforeach
@endif

Expand All @@ -27,10 +31,3 @@

@yield('after_styles')
@stack('after_styles')

{{-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --}}
{{-- WARNING: Respond.js doesn't work if you view the page via file:// --}}
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
tabacitu marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion src/resources/views/base/inc/scripts.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@if (config('backpack.base.scripts') && count(config('backpack.base.scripts')))
@foreach (config('backpack.base.scripts') as $path)
<script type="text/javascript" src="{{ asset($path).'?v='.config('backpack.base.cachebusting_string') }}"></script>
tabacitu marked this conversation as resolved.
Show resolved Hide resolved
@if(is_array($path))
@basset(...$path)
@else
@basset($path)
@endif
@endforeach
@endif

Expand Down
6 changes: 1 addition & 5 deletions src/resources/views/base/widgets/script.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
@endphp

@push($widget['stack'] ?? 'after_scripts')
<script src="{{ $src }}"
@foreach($attributes as $key => $value)
{{ $key }}{!! $value === true || $value === '' ? '' : "=\"$value\"" !!}
@endforeach
></script>
@basset($src, true, $attributes, 'script')
@endpush
6 changes: 1 addition & 5 deletions src/resources/views/base/widgets/style.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@
@endphp

@push($widget['stack'] ?? 'after_styles')
<link href="{{ $href }}" type="text/css"
@foreach($attributes as $key => $value)
{{ $key }}{!! $value === true || $value === '' ? '' : "=\"$value\"" !!}
@endforeach
/>
@basset($href, true, $attributes, 'style')
tabacitu marked this conversation as resolved.
Show resolved Hide resolved
@endpush
5 changes: 3 additions & 2 deletions src/resources/views/crud/fields/summernote.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
{{-- FIELD CSS - will be loaded in the after_styles section --}}
@push('crud_fields_styles')
{{-- include summernote css --}}
@loadOnce('packages/summernote/dist/summernote-bs4.css')
@basset('https://unpkg.com/[email protected]/dist/summernote-bs4.min.css')
@basset('https://unpkg.com/[email protected]/dist/font/summernote.woff2', false)
tabacitu marked this conversation as resolved.
Show resolved Hide resolved
@loadOnce('summernoteCss')
<style type="text/css">
.note-editor.note-frame .note-status-output, .note-editor.note-airframe .note-status-output {
Expand All @@ -43,7 +44,7 @@
{{-- FIELD JS - will be loaded in the after_scripts section --}}
@push('crud_fields_scripts')
{{-- include summernote js --}}
@loadOnce('packages/summernote/dist/summernote-bs4.min.js')
@basset('https://unpkg.com/summernote@0.8.20/dist/summernote.min.js')
tabacitu marked this conversation as resolved.
Show resolved Hide resolved
@loadOnce('bpFieldInitSummernoteElement')
<script>
function bpFieldInitSummernoteElement(element) {
Expand Down
12 changes: 6 additions & 6 deletions src/resources/views/crud/inc/datatables_logic.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
@endphp

{{-- DATA TABLES SCRIPT --}}
<script type="text/javascript" src="{{ asset('packages/datatables.net/js/jquery.dataTables.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('packages/datatables.net-bs4/js/dataTables.bootstrap4.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('packages/datatables.net-responsive/js/dataTables.responsive.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('packages/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('packages/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('packages/datatables.net-fixedheader-bs4/js/fixedHeader.bootstrap4.min.js') }}"></script>
@basset('https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js')
@basset('https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap4.min.js')
@basset('https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js')
@basset('https://unpkg.com/datatables.net-responsive-bs4@2.2.9/css/responsive.bootstrap4.min.css')
@basset('https://cdn.datatables.net/fixedheader/3.2.4/js/dataTables.fixedHeader.min.js')
@basset('https://unpkg.com/datatables.net-fixedheader-bs4@3.2.4/css/fixedHeader.bootstrap4.min.css')

<script>
// here we will check if the cached dataTables paginator length is conformable with current paginator settings.
Expand Down
16 changes: 8 additions & 8 deletions src/resources/views/crud/inc/export_buttons.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@if ($crud->exportButtons())
<script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.bootstrap4.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/pdfmake.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/vfs_fonts.js" type="text/javascript"></script>
<script src="//cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js" type="text/javascript"></script>
<script src="//cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js" type="text/javascript"></script>
<script src="//cdn.datatables.net/buttons/1.5.6/js/buttons.colVis.min.js" type="text/javascript"></script>
@basset('https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js')
@basset('https://cdn.datatables.net/buttons/1.5.6/js/buttons.bootstrap4.min.js')
@basset('https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js')
@basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/pdfmake.min.js')
@basset('https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.18/vfs_fonts.js')
@basset('https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js')
@basset('https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js')
@basset('https://cdn.datatables.net/buttons/1.5.6/js/buttons.colVis.min.js')
<script>
let dataTablesExportStrip = text => {
if ( typeof text !== 'string' ) {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/crud/inc/filters_navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</nav>

@push('crud_list_scripts')
<script src="{{ asset('packages/URI.js/URI.min.js') }}" type="text/javascript"></script>
@basset('https://unpkg.com/[email protected]/src/URI.min.js')
<script>
function addOrUpdateUriParameter(uri, parameter, value) {
var new_url = normalizeAmpersand(uri);
Expand Down
6 changes: 3 additions & 3 deletions src/resources/views/crud/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ class="bg-white table table-striped table-hover nowrap rounded shadow-xs border-

@section('after_styles')
{{-- DATA TABLES --}}
<link rel="stylesheet" type="text/css" href="{{ asset('packages/datatables.net-bs4/css/dataTables.bootstrap4.min.css') }}">
<link rel="stylesheet" type="text/css" href="{{ asset('packages/datatables.net-fixedheader-bs4/css/fixedHeader.bootstrap4.min.css') }}">
<link rel="stylesheet" type="text/css" href="{{ asset('packages/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css') }}">
@basset('https://cdn.datatables.net/1.12.1/css/dataTables.bootstrap4.min.css')
@basset('https://unpkg.com/datatables.net-fixedheader-bs4@3.2.4/css/fixedHeader.bootstrap4.min.css')
@basset('https://unpkg.com/datatables.net-responsive-bs4@2.2.9/css/responsive.bootstrap4.min.css')

{{-- CRUD LIST CONTENT - crud_list_styles stack --}}
@stack('crud_list_styles')
Expand Down
4 changes: 2 additions & 2 deletions src/resources/views/crud/reorder.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ function tree_element($entry, $key, $all_entries, $crud)
@endsection

@section('after_scripts')
<script src="{{ asset('packages/jquery-ui-dist/jquery-ui.min.js') }}" type="text/javascript" ></script>
<script src="{{ asset('packages/nestedSortable/jquery.mjs.nestedSortable2.js') }}" type="text/javascript" ></script>
@basset('https://unpkg.com/jquery-ui@1.13.2/dist/jquery-ui.min.js')
@basset('https://cdnjs.cloudflare.com/ajax/libs/nestedSortable/2.0.0/jquery.mjs.nestedSortable.min.js')
tabacitu marked this conversation as resolved.
Show resolved Hide resolved

<script type="text/javascript">
jQuery(document).ready(function($) {
Expand Down
42 changes: 1 addition & 41 deletions webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,7 @@ mix.sass('src/resources/assets/scss/blue-bundle.scss', 'src/public/packages/back
// copy the Backstrap CSS
mix.copy('node_modules/@digitallyhappy/backstrap/dist/css', 'src/public/packages/@digitallyhappy/backstrap/css');

// copy fonts and other assets
mix.copy('node_modules/line-awesome/dist/line-awesome', 'src/public/packages/line-awesome')
.copy('node_modules/source-sans-pro', 'src/public/packages/source-sans-pro')
.copy('node_modules/animate.css/animate.min.css', 'src/public/packages/animate.css/animate.min.css')
.copy('node_modules/animate.css/animate.compat.css', 'src/public/packages/animate.css/animate.compat.css')
.copy('node_modules/noty/lib', 'src/public/packages/noty');


// copy CRUD filters JS into packages
mix.copy('node_modules/bootstrap-datepicker/dist', 'src/public/packages/bootstrap-datepicker/dist')
.copy('node_modules/moment/min', 'src/public/packages/moment/min')
.copy('node_modules/select2/dist', 'src/public/packages/select2/dist')
.copy('node_modules/jquery-colorbox', 'src/public/packages/jquery-colorbox')
.copy('node_modules/jquery-ui-dist', 'src/public/packages/jquery-ui-dist')
.copy('node_modules/select2-bootstrap-theme/dist', 'src/public/packages/select2-bootstrap-theme/dist')
.copy('node_modules/bootstrap-daterangepicker/daterangepicker.css', 'src/public/packages/bootstrap-daterangepicker/daterangepicker.css')
.copy('node_modules/bootstrap-daterangepicker/daterangepicker.js', 'src/public/packages/bootstrap-daterangepicker/daterangepicker.js')
.copy('node_modules/pc-bootstrap4-datetimepicker/build', 'src/public/packages/pc-bootstrap4-datetimepicker/build')
.copy('node_modules/cropperjs/dist', 'src/public/packages/cropperjs/dist')
.copy('node_modules/jquery-cropper/dist', 'src/public/packages/jquery-cropper/dist')
// note that we change the directory name here;
// see https://github.com/Laravel-Backpack/CRUD/issues/3883 for details
.copy('node_modules/ckeditor4', 'src/public/packages/ckeditor')
.copy('node_modules/bootstrap-colorpicker/dist', 'src/public/packages/bootstrap-colorpicker/dist')
.copy('node_modules/bootstrap-iconpicker/bootstrap-iconpicker', 'src/public/packages/bootstrap-iconpicker/bootstrap-iconpicker')
.copy('node_modules/bootstrap-iconpicker/icon-fonts', 'src/public/packages/bootstrap-iconpicker/icon-fonts')
.copy('node_modules/easymde/dist', 'src/public/packages/easymde/dist')
.copy('node_modules/summernote/dist', 'src/public/packages/summernote/dist')
.copy('node_modules/tinymce', 'src/public/packages/tinymce')
.copy('node_modules/nestedSortable', 'src/public/packages/nestedSortable')
.copy('node_modules/datatables.net', 'src/public/packages/datatables.net')
.copy('node_modules/datatables.net-bs4', 'src/public/packages/datatables.net-bs4')
.copy('node_modules/datatables.net-fixedheader', 'src/public/packages/datatables.net-fixedheader')
.copy('node_modules/datatables.net-fixedheader-bs4', 'src/public/packages/datatables.net-fixedheader-bs4')
.copy('node_modules/datatables.net-responsive', 'src/public/packages/datatables.net-responsive')
.copy('node_modules/datatables.net-responsive-bs4', 'src/public/packages/datatables.net-responsive-bs4')
.copy('node_modules/places.js/dist', 'src/public/packages/places.js/dist')
.copy('node_modules/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js', 'src/public/packages/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js')
.copy('node_modules/urijs/src/URI.min.js', 'src/public/packages/URI.js/URI.min.js');

tabacitu marked this conversation as resolved.
Show resolved Hide resolved
// FOR MAINTAINERS
// copy asset files from Base's public folder the main app's public folder
// so that you don't have to publish the assets with artisan to test them
mix.copyDirectory('src/public', '../../../public')
mix.copyDirectory('src/public', '../../../public')