Passionate about JavaScript | Minimalism fan

8 Followers
·
Follow

Scrolling layout example
Scrolling layout example

SVELTE

In a few lines, you can have a component that you will actually use across your pages

In this tutorial, we will implement a Svelte component that serves as a structure for our project’s pages.

It comes in handy when our pages have similar layouts and we want to react to content scroll.

The structure we will build here is composed by:

  • main content: scrollable

We can obviously adapt the component to our needs. You can skip to the end if you only want the complete component code.

Adding header and footer

We start adding the main content layout. …


JAVASCRIPT

Let’s internationalize our webapp with this simple method

Image for post
Image for post
Photo by Artem Beliaikin on Unsplash

When we are working on a webapp that we want to distribute globally, we must think that many people will not speak our language. If they don’t understand us, we can lose a large chunk of users.

In my experience with JavaScript projects, I refined the process to manage multiple languages in the simplest way possible, in a way that I can add a new language or edit existing strings in less time, and with less errors.

How to manage different languages

In this tutorial we will learn how to create a plugin that brings a language file, parse it, and return the required string in the user’s language. …


SVELTE

We can avoid unnecessary packages with few lines of code

Image for post
Image for post
Photo by Javier Allegue Barros on Unsplash

In Single Page Applications, for example when we are using a JavaScript framework (as our beloved Svelte), we need to provide a method for our users to navigate between sections of the website as they need.

Since in SPA all the web page requests are redirected to the root page, we need to simulate the “standard” way of navigating pages. This is where routing libraries help us, and although it seems like a complicated task to reproduce, its base functionality is very simple and can be done in few lines of code.

At the end of the article, we can use our own router, maybe for our next project. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store