Needs advice


I want to generate dynamic CSS for each user with an expiry link.

I've created a cloud-based tool (Example - where people can create tables and use them on their website by pasting the HTML generated by the tool.

Now, there are a few styling options needed, which can be done using CSS. As of now, I'm asking the users to copy the CSS and paste it in the "Custom CSS" section, which is a bit hectic work as they need to change the CSS every time if I make any changes to the styling.

So, I'm just wondering if there's a way to generate dynamic CSS for each user with an expiry link.

Currently, I have around 200 users, and what's the best way to do it?

4 upvotes·49.2K views
Replies (2)

The best way, as usual, is a "it depends".

Still I would go to something as simple as storing the expire date+the generated css and other metadata in a table. If a user tries to access something that is expired than he's redirected to a specific page. Periodically (like once a day), a janitor process deletes the old data.

3 upvotes·47.8K views
Developer at GMS LLC·

Instead of having the user copy and paste the CSS directly, have them copy and paste the HTML that will include an external CSS file generated and hosted by your application. This will allow you to control when the stylesheet is updated as well as control privileges on who can request the file. Additionally, using a CDN service (e.g. Cloudflare) will allow you to cache the static assets being requested reducing overall server load.

When your server (and optionally CDN) no longer are serving the file, consider the link expired. Unique URLs can be generated using a multitude of methods but maybe consider if there is any benefit to the users if it follows the scheme: rather than something like:

3 upvotes·47.7K views
Avatar of Bruno Miguel

Bruno Miguel