hlaueriksson / GEmojiSharp

:octocat: GitHub Emoji for C#, ASP.NET Core and Blazor, dotnet tool for the terminal and PowerToys Run plugin
https://hlaueriksson.github.io/GEmojiSharp/
MIT License
116 stars 8 forks source link

blazor webassembly = erro #9

Closed drma-tech closed 2 years ago

drma-tech commented 3 years ago

I didn't see anything in the documentation about something to register the dll in program.cs so that these files can be recognized

GET https://localhost:5001/_content/GEmojiSharp.Blazor/style.css net::ERR_ABORTED 404
GET https://localhost:5001/_content/GEmojiSharp.Blazor/script.js net::ERR_ABORTED 404

image

hlaueriksson commented 3 years ago

Hi @drma-dev

Update wwwroot/index.html and add these two lines:

<link href="_content/GEmojiSharp.Blazor/style.css" rel="stylesheet" />
<script src="_content/GEmojiSharp.Blazor/script.js"></script>

It is briefly mentioned in the README, but I should clarify the documentation.

You can take a look at line 12 and line 47 of a sample index.html.

drma-tech commented 3 years ago

I did it and that's exactly why this error is happening (he tries to look for something that doesn't exist). You must have the reference in program.cs

hlaueriksson commented 3 years ago

Right. I think you need to import the GEmojiSharp.Blazor namespace in the _Imports.razor file.

Check out the sample file at line 11.

drma-tech commented 3 years ago

References in _import.razor only allow the use of components within razor pages.

To recognize the js and css files (of any component) you need to create these references within program.cs (or startup.cs, depending on the type of project).

It would have to have a code something like this: Services.AddGEmoji(); This tells the project that there are static files that need to be read at startup.

hlaueriksson commented 3 years ago

I don't know how to reproduce this.

Are you able to run the sample app?