SAP / project-portal-for-innersource

Lists all InnerSource projects of a company in an interactive and easy to use way. Can be used as a template for implementing the "InnerSource portal" pattern by the InnerSource Commons community.
https://sap.github.io/project-portal-for-innersource/
Apache License 2.0
142 stars 70 forks source link

[bug] mediaURL 404 (Not Found) #10

Closed spier closed 3 years ago

spier commented 3 years ago

When checking the logs of the browser console, I noticed one error that gets reported there:

index.html:104 GET http://127.0.0.1:8080/[[mediaURL]] 404 (Not Found)

There are many more placeholder values in index.html that are similar to [[mediaURL]]. However somehow only this instance in line 104 is causing an error.

You can also confirm this in the demo project.

Michadelic commented 3 years ago

That's because of the HTML templates which are stored in the HTML page directly. The browser parses them and tries to resolve the src with a template variable. An alternative to avoid this would be to not set the "src" attribute and set it while filling the template or to load the templates from a separate file to avoid the initial parsing.

spier commented 3 years ago

Got it.

We spoke about the home-grown minimalistic templating system used in this project in a separate thread. Was that a conscious design decision i.e. did you want to keep this project free of a 3rd party templating system on purpose?

I am asking because when reading the source, I found that part a bit hard to understand in index.html and index.js.

And sorry if this conversation might be somewhat out of context for this issue, but it is related to the templating approach in general at least :)

Michadelic commented 3 years ago

Yes, i was testing out plain VanillaJS without any thirdparty for this project - feel free to suggest or introduce a templating system though if it makes maintenance of the project easier

spier commented 3 years ago

I am not an expert on this either. A very slim templating system would be nice though. Not urgent for sure.

Michadelic commented 3 years ago

I experimented a bit with Handlebars and found this implementation a lot better than the custom templating, thx for the hint

spier commented 3 years ago

Kind of cool that that also fixed this issue as a side effect :)