Jump to content

Recommended Posts

Posted

In this tutorial, I will show you how to use Svelte with RAGEMP for CEF.

You will first normally create your Svelte project, and when you're done, save and run npm run build. You will then receive a new folder in your project called dist. 
Opening the dist folder, you will find index.html, a folder named assets, and maybe some other files depending on your project. If you try to run your project now by opening index.html, you will find a blank page. That's because Svelte bundles your project with relative paths, which will not work with how RAGEMP CEF's system work. To fix this, you simply change the paths to absolute paths manually.

Here is my index#html, before changing anything. You can see the relative paths. (I removed the icon, if you have one)

spacer.png

And after changing the relative paths to absolute paths, I'm left with this.
 

spacer.png

It's a minimal change, and may be hard to notice, but the source for the script file is missing a slash in the start, same for the CSS. You can now open the index#html, and see that it's working.

Some last words

If you have a custom font you want to use, which is located in your project, you will have to open the CSS file and change the paths there as well. 

This tutorial covered Svelte, and not SvelteKit.

I'm using "#" instead of a "." because otherwise I can't post due the websites security rules.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...