This project provides a utility to periodically fetch stylesheets from dev.to and make them available for use in your own projects.
A cron job that:
An HTTP endpoint that:
Set up the Stylesheet Fetcher:
devto-stylesheet-fetcher.ts to run at your desired interval (e.g., daily)Set up the Stylesheet Provider:
devto-stylesheet-provider.tsThere are several ways to use the dev.to stylesheets in your project:
<script src="https://your-val-town-url.val.run/embed.js"></script>
This will dynamically load all the dev.to stylesheets into your page.
<link rel="stylesheet" href="https://your-val-town-url.val.run/embed.css">
This loads a CSS file that imports all the dev.to stylesheets.
Fetch the stylesheets programmatically:
fetch("https://your-val-town-url.val.run/api/stylesheets")
.then(res => res.json())
.then(data => {
// Use the stylesheet URLs as needed
console.log(data.stylesheets);
});
GET / - Documentation and status pageGET /api/stylesheets - Get the current stylesheets as JSONGET /api/history - Get the history of stylesheet changesGET /embed.js - JavaScript snippet to load the stylesheetsGET /embed.css - CSS file that imports all the stylesheetsThe utility uses Val Town's blob storage with the following keys:
devto_stylesheets - Current stylesheet datadevto_stylesheets_last_updated - Timestamp of last updatedevto_stylesheets_history - History of stylesheet changes