Laravel Jestream how to add external javascript

  jetstream, laravel, laravel-blade, summernote

I want to include this Summernote rich text editor in Laravel Jetstream Livewire Alpine.

I tried to extend the possibility to include additional Javascript and CSS by using the @stack() directive, right in the layouts/app.blade.php file:

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('', 'Laravel') }}</title>

        <!-- Fonts -->
        <link rel="stylesheet" href="[email protected];600;700&display=swap">

        <!-- Styles -->
        <link rel="stylesheet" href="{{ mix('css/app.css') }}">


        <!-- Scripts -->
        <script src="{{ mix('js/app.js') }}" defer></script>
    <body class="font-sans antialiased">
        <x-jet-banner />

        <div class="min-h-screen bg-gray-100">

            <!-- Page Heading -->
            @if (isset($header))
                <header class="bg-white shadow">
                    <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
                        {{ $header }}

            <!-- Page Content -->
                {{ $slot }}



Inside my blade view I included the summernote js and css CDN links as follows:

    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Dashboard') }}

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
                <form action="{{ route('post') }}" method="post">
                    <label class="block text-gray-700 text-sm font-bold mb-2" for="fuente">
                        Your text
                    <div id="summernote">
                        <textarea name="fuente" id="fuente" class="w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none" rows="4"></textarea>
                    <button type="submit" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 mt-6 border border-blue-700 rounded">

    <link href="[email protected]/dist/summernote-lite.min.css" rel="stylesheet">

    <script src="" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="[email protected]/dist/summernote-lite.min.js"></script>
            placeholder: 'Hello stand alone ui',
            tabsize: 2,
            height: 120,
            toolbar: [
                ['style', ['style']],
                ['font', ['bold', 'underline', 'clear']],
                ['color', ['color']],
                ['para', ['ul', 'ol', 'paragraph']],
                ['table', ['table']],
                ['insert', ['link', 'picture', 'video']],
                ['view', ['fullscreen', 'codeview', 'help']]

However, the editor is not loading. If I load the source code of the blade view, I don’t see the Summernote javascript.

What am I missing? How do I make it work?

Source: Laravel

Leave a Reply