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

Preline.js doesn't work in production - SvelteKit #110

Closed
digitaldrreamer opened this issue Jul 27, 2023 · 4 comments
Closed

Preline.js doesn't work in production - SvelteKit #110

digitaldrreamer opened this issue Jul 27, 2023 · 4 comments

Comments

@digitaldrreamer
Copy link

digitaldrreamer commented Jul 27, 2023

Whenever I build SvelteKit, preline.js in the node_modules file is not bundled with it.

I found a workaround for this: copy the preline.js from the node_modules file into the /static folder and link to it in the index.html with %sveltekit.assets%/preline.js. It works this way.

But this should be in the docs.

@digitaldrreamer
Copy link
Author

digitaldrreamer commented Jul 27, 2023

Perhaps before the "Add the Preline UI JavaScript" section in the docs, there should be a section to copy the preline.js file via cli (since they'll be using the terminal for the setup anyway)

Something like this:

Run this command in your terminal. Make sure you're in the root directory of your svelte project first. You can navigate by using cd /yourProjectDirectory. This command copies the script file to your svelte static folder.

On Windows:

mkdir ./static/preline
copy ./node_modules/preline/dist/preline.js ./static/preline

On Linux and Mac:

mkdir ./static/preline
cp ./node_modules/preline/dist/preline.js ./static/preline/

Add the Preline UI JavaScript
Include the JavaScript <script> that powers the interactive elements near the end of your tag:

// app.html
<script src="%sveltekit.assets%/preline/preline.js"></script>

This works for me🙂

@kevan-mtl
Copy link

Works for me, but shouldn't step 4 be based on your step 3?
<script src="%sveltekit.assets%/preline/preline.js"></script>

@digitaldrreamer
Copy link
Author

Works for me, but shouldn't step 4 be based on your step 3?
<script src="%sveltekit.assets%/preline/preline.js"></script>

@kevan-mtl Thanks. I saw the mistake. Fixed it.

@Mr-Zafar
Copy link
Collaborator

Mr-Zafar commented Nov 7, 2023

@kevan-mtl marking it as closed for now. If you have more details to share in the future, feel free to open a new issue.

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

3 participants