Experimenting with NextJS as a simpler alternative to Gatsby.
git clone --recursive https://github.com/onflow/next-docs
- Install deps:
yarn yarn dev
You can now visit a page from the Cadence Github repo, try: http://localhost:3000/cadence/language/accounts
The current Gatsby site was bulit on top of an existing Gatsby theme and has inhereted much that is now hard to refactor or reconfigure. This rework is an attempt to achieve greater customizability, and faster iteration cycles, less code and an overall simpler design for the site, without sacrificing any features obtained by the previous Gatsby-based site.
Less code/config
- Current (Gatsby) site configuration is spread between the main site config and the 'theme config', with no clear seperation.
Faster Builds
- Current (Gatsby) build/refresh takes ~45 seconds when config is changed. The config file specifies the menus and content structure so is changed often, resulting in very slow iteration. This site build.refres/ cycle completes in ~2 seconds.
Better CSS
- Current (Gatsby) theme css is difficult to customize and uses outdatet 'BEM' styles css. This site uses the powerful Tailwind CSS utilities.
- Render Markdown/MDX
- Import Markdown/MDX content from Github
- Auto-link headers
- Static site generation
- Breadcrumbs
- Dynamic menus
- Algolia
- Analytics
- GraphQL API (Not needed)
- Docs versioning
- Bi-Directional Github updates
- Dynamic SEO images
- Dark Mode
- Next Images (optimized images)
- Responsive typography
- Customizable theme
- Mobile-first PWA
- Prism syntax highlighting for Cadence
- Offline support
This repo contains a link to PrismJS (Temporarily while we develop a syntax highlighter).
To develop using Prism:
git submodule update --init --recursive- Add the following to
components.jsoninlib/prismjsunder"languages":
"cadence": {
"title": "Cadence",
"option": "default",
"owner": "onflow"
},
- Add
lib/prism-cadence.jstolib/prismjs/components cd lib/prismjs && npm i && npm buildnpm run start
The syntax highlighting definition can be found here: lib/prismjs/components/prism-cadence.js
Load http://localhost:5000/test.html and select Cadence as the highlighting option.
Update the definition file and refresh the browser to see the result.