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

Autoload doesnt work for me #5

Open
martincodes-de opened this issue Feb 12, 2022 · 0 comments
Open

Autoload doesnt work for me #5

martincodes-de opened this issue Feb 12, 2022 · 0 comments

Comments

@martincodes-de
Copy link

Hey, i want to use this nice package, but the autoload doesnt work. It only works if i include the script tags manually. How can we fix this? My files:

const mix = require('laravel-mix');
require("./vendor/nickpoulos/laravel-svelte-direct/src/js/mix");

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel applications. By default, we are compiling the CSS
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [
        //
    ]);

mix.svelteDirect(
    "resources/js/svelte",
    "public/js"
);
<!-- svelte-ignore missing-custom-element-compile-options -->
<svelte:options tag="hello-world" />

<h1>Hello Peter</h1>
<!doctype html>
<html>
<head>
    <title>My Example App</title>
</head>
<body>
<div class="container">

    <!-- example Svelte components here -->
    <hello-world></hello-world>
    <!-- end components -->

</div>

<script type="text/javascript">
    // tie your components together using vanilla js or something ike alpine
</script>

<!-- START Svelte Direct Component JavaScript -->
@stack('sveltedirect')
<!-- END Svelte Direct Component JavaScript -->
</body>
</html>

This blade file works (because i require the file from public/js/hello-world.js manually:

<!doctype html>
<html>
<head>
    <title>My Example App</title>
    <script src="{{ asset("js/hello-world.js") }}"></script>
</head>
<body>
<div class="container">

    <!-- example Svelte components here -->
    <hello-world></hello-world>
    <!-- end components -->

</div>

<script type="text/javascript">
    // tie your components together using vanilla js or something ike alpine
</script>

<!-- START Svelte Direct Component JavaScript -->
@stack('sveltedirect')
<!-- END Svelte Direct Component JavaScript -->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant