Web Development

3431 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
276
 
 

Hello,

My goal is to make specific edits to Lemmy's default frontend. The big problem I'm facing is that the UI is running inside a docker container and is also written using inferno which seems to be transpiled / compiled into non-user-friendly js files.

My assumption here is that I'd have to download the source, edit it, compile and then host my own container.

I was wondering if anyone has done this and if there are any tips, pointers or guides that could be shared.

Thank you!

277
278
 
 

I like CMD + D to select the next identical selection, OPT + DOWN/UP to move the selections down or up a line, SHIFT + OPT + DOWN/UP to duplicate the selection, and CMD + / to turn the line into a comment. How bout you?

279
280
281
282
 
 

htmx is a very different way of developing your web application. You can define a lot of behaviour inside your HTML with the new attributed added by htmx. This allows you to build an interactive website without using any JavaScript. You do need a REST API that returns HTML though.

For more information about HTMX you can read the htmx docs.

283
 
 

TLDR; Does anyone know if there's an initiative to use the pdf rendering engines built into most browsers and used while printing a web page in more flexible ways? Ideally from javascript being able to get the pdf as a File.

I've been looking into download as pdf functionality we implemented at work. It's for a single project, relatively small, so we implemented it with html2pdf.js. There seems to be no better way than rendering the webpage as canvas and saving as an image inside PDF. Although I'm thankful that the project exists, with the lack of text selection, poor image quality and/or large file sizes, it feels bad serving it to the customer. Then I started to look into the printed version and I loved it. Learned some new stuff about css, being able to break a page before a specific element. Tables automatically repeat their header across a page break. I can also save this as pdf, better quality, 40x reduction in file size, yay! However, web api to start this is print(), no arguments, no alternatives. Putting this behind a "Download" buttons seems confusing for the end user. I'm amazed we can't use this built in pdf rendering engine in more flexible ways. (See TLDR for question)

284
 
 

To crop an image effectively, it’s important to prioritize a specific part of the image and preserve the essential content around it. One way to achieve this is by identifying the image’s ‘focal point’ - the part of the image that is most important - and cropping the image around it.

In this post, I’ll walk you through my technique for cropping images with CSS while preserving the image’s focal point.

285
286
20
Typescript 5.2 beta announcement (devblogs.microsoft.com)
submitted 1 year ago by spartanatreyu to c/webdev
 
 

Shows a great example of JS' new using keyword (similar to defer in D, Go, Swift, etc...)

287
 
 

Hello, I have a problem with CORS and I think this is right community to get help.

When I use this code:

import { LemmyHttp } from 'lemmy-js-client';
const client = new LemmyHttp('https://lemmy.ml');
const { posts } = await client.getPosts({
    limit: 10,
    page: 1
});

to get posts from lemmy.ml (using lemmy-js-client), I get:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://lemmy.ml/api/v3/post/list?limit=10&page=1. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 400.

I have tried to add header like this:

const client = new LemmyHttp('https://lemmy.ml', {
    headers: {
        'Access-Control-Allow-Origin': '*'
    }
});

but result is the same.

Can someone help me with this?

288
 
 

so im looking to make a login for a website using PHPmyadmin, im pretty new to the whole SQL PHP thing, i can get the tables setup and everything working for the most part, having some issues getting the

session_start(); $DATABASE_HOST = ‘’; $DATABASE_USER = ‘’; $DATABASE_PASS = ‘’; $DATABASE_NAME = ‘’;

part figured out, i know the host is the server IP/location, its the user/pass/database tags im confused about, there is an ANY account on my database admin page that can read data from the databases but is it possible to set it up so that way its an account that only has the ability to read the accounts table? like:

$DATABASE_USER = ‘login’; $DATABASE_PASS = ‘*’; $DATABASE_NAME = ‘Accounts’;

also the database name need to be the name of the database not the table correct? stupid question but just want to be 100% sure i know how some languages can be lol.

also, is it possible to take a users public PGP key, encrypt a random string of text and serve it to them, and have them verify the text with their private key as a way to authenticate identity?

289
 
 

I recently rebuilt a moderately sized jQuery application/component using Lit, with the end result being 6-7 components spread over around 2,000 lines of code.

We currently have no automated testing at all but I'd like to implement it, especially now as the markup/styles have been moved into JavaScript. It's much better overall - but it feels riskier.

But I have no idea where to even begin. Do I set up end to end tests using Playwright on site? Can I test the components individually? Keeping in mind as well that we don't use a build system/any sort of CI.

Just wanted to get people's thoughts/experiences here.

290
 
 

I see this more and more lately: go to log in to some site, and they only show the username field. Enter username, click Submit, then a password field appears. Enter password, click Submit again, and then we're logged in.

This makes using a password manager super annoying, because I have to trigger the autofill twice.

Is there some security-related reason more sites are doing this? Is it an anti-bot thing? I'm just really curious, because it seems so pointless on its face, but it seems to be spreading.

291
 
 

For a while I've noticed that many people use dotenv in a suboptimal way, so yesterday I took the time to write a short article about better usage patterns (pretty basic stuff, so if you are an expert it's likely that you will find it boring):

292
 
 

Here’s a quick summary of the different ways you can load a website.

SSR (Server Side Rendering): The classic way. Browser makes request to server, server creates an HTML/CSS/JS bundle, sends it to browser.

CSR (Client Side Rendering): The vanilla React way. Browser makes a request to server, server sends back JS code which runs on browser, creating the HTML/CSS and triggering browser to further make requests to load all assets.

SSG (Static Site Generation): The “gotta go fast” way. Server creates an HTML/CSS/JS bundle for web pages at build time. When browser requests a page, the server just sends this pre-built bundle back.

ISG (Incremental Static Generation): The “imma cache stuff” way. Server may create some HTML/CSS/JS bundles for web pages at build time. When the browser requests a page, the server sends this pre-built bundle back. If a pre-built bundle doesn’t exist, it falls back to CSR while it builds the bundle for future requests. The server may auto-rebuild bundles after certain time intervals to support changing content.

ESR (Edge Slice Re-rendering): The “cutting edge, let's get latency down so low it's practically in hell” way. Server does SSG and tells the CDN to cache the bundles. Then, it instructs the CDN to update the bundle in the event that page content needs to change.

In order of performance, usually: (SSG = ISG = ESR) > CSR > SSR

In order of SEO: (SSR = SSG = ISG = ESR) > CSR

In order of correctness (will users be shown “stale” information?): (SSR = CSR) > ESR > ISG > SSG

293
22
submitted 1 year ago by starman to c/webdev
294
295
296
297
 
 

Hi all. I'm looking to make a backend in my NGINX server, for a website that only gets a few views. Right now I'm managing the files of the site using Git, with /var/www/ as the folder on github. I'm looking to create an ip logger to plot onto a map, and I'm wondering if there are any problems with hosting it on /var/www. My main concerns are if it's accessible to other users or if it'll slow down NGINX. I'm absolutely able to do it in another folder, but I am wondering if there are any problems with keeping any files in /var/www. To my knowledge, only past /var/www/html is viewable by a connection.

Thanks!

298
 
 

The results of this year Stack Overflow survey have been published: https://survey.stackoverflow.co/2023/ There is a lot to go through, so if you prefer it in a video format, these kinds of videos can help and also provide some comments on the raw data that you see.

299
300
14
submitted 1 year ago by starman to c/webdev
view more: ‹ prev next ›