Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sawyerclick/cmsvelte

A Svelte template built with newsroom CMS's in mind
https://github.com/sawyerclick/cmsvelte

data-visualization embeds iframe journalism newsroom svelte

Last synced: about 1 month ago
JSON representation

A Svelte template built with newsroom CMS's in mind

Awesome Lists containing this project

README

        

# **CMS**velte

A [Svelte](https://svelte.dev/) starter template built with newsroom CMS's in mind. Dynamically create inline graphics based on the placement of `figure` elements with defined *data-cmsvelte* attributes.

Inspired by graphics rigs at Bloomberg, The Pudding, and The Wall Street Journal. Created with the help of [Kazi Awal](https://github.com/superKazi).

*Previously known as tiny-svelte*.

## Local env requirements

- [Node 16 LTS](https://nodejs.org/dist/latest-v16.x/docs/api/)

## Useful docs to features

- [Svelte](https://svelte.dev/docs) as a component framework
- [Vite](https://vitejs.dev/guide/) (with [Rollup](https://rollupjs.org/guide/en/) under the hood) for front-end tooling
- [TailwindCSS](https://tailwindcss.com/) + [PostCSS](https://postcss.org/) for predefined styles, classes and syntax
- [ArchieML](http://archieml.org/) as a micro-CMS powered by Google Docs
- [ai2html](http://ai2html.org/) for responsive static images and charts
- [D3](https://github.com/d3/d3) + [LayerCake](https://layercake.graphics/) for charting
- [vite-imagetools](https://www.npmjs.com/package/vite-imagetools) for transforming images on the fly in Vite using Sharp

### Quickstart

Use [degit](https://www.npmjs.com/package/degit) to create a new repo using this one as a template.

```bash
npx degit sawyerclick/cmsvelte my-cmsvelte
```

## Scripts

### `npm run fetch:sheet`

This template has out-of-the-box features to help with consuming data from google sheets. Tag the Google Sheet for your graphic in `./config.json` and make sure you have the ID and sheet ID (gid) filled out correctly. Make sure the share permissions on the sheet are set up so that it is viewable by anyone with the share link. **Note: Don't make it available to edit by anybody!**

Directly import csv's into your .svelte file via [@rollup/plugin-dsv](https://www.npmjs.com/package/@rollup/plugin-dsv)

```js
import data from '$lib/data/data.csv'
```

### `npm run fetch:copy`

Like a lot of newsrooms, this uses a Google Doc and ArchieMl approach to make copy content management easier. The setup is similar to using Sheets data. Make sure the share permissions on the doc are set up so that it is viewable by anyone with the share link. Grab the document ID from the address bar — ...com/document/d/**1IiA5a5iCjbjOYvZVgPcjGzMy5PyfCzpPF-LnQdCdFI0**/edit — and paste it into the respective property in `./config.json`.

[htmlparser2](https://www.npmjs.com/package/htmlparser2) and [html-entities](https://www.npmjs.com/package/html-entities) act as a middle man to catch various tags like ``, ``, `