1.2.4 • Published 1 year ago

ramidus v1.2.4

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Ramidus

Ramidus is a Single Page Application (SPA) template built for custom elements, bringing many of the benefits of frameworks like Next or Nuxt to vanilla sites. Unlike those frameworks, you're not locked into one way of doing things: all of the code is included in your project, and you are free to modify it however you wish.

Features

  1. Instant SPA page loading using the <app-root> and <app-link> elements.
  2. Pre-load high-profile pages after the first page loads.
  3. Share templates between pages using the <app-layout> element.
  4. Easily embed markdown and syntax-highlighted files using the <mark-down> element.
  5. Familiar conventions, similar to Next or Nuxt.
  6. No hidden code: customize anything exactly the way you like it.

Getting Started

Setup is easy and no tooling is required. You can scaffold your project using npx or simply download this zip file.

npx ramidus@latest && npm run dev

Project Structure

Global content like components, assets, layouts and your site's head are contained in the "@" folder. This naming convention keeps the folder first alphabetically so it's always easy to find.

  • @
    • assets
    • components
    • css
    • build.js
    • main.js
    • head.json
  • docs
    • index.html
  • index.html

Pages

Each page must have its own folder containing an index.html file, i.e. /about/index.html. Shared page elements are contained in the <app-layout> custom element.

Every page must include the following markup.

<body>
  <app-layout>
    <!-- Page Content -->
  </app-layout>
  <script src="/@/main.js" type="module"></script>
</body>

You can include markdown on any page using the <mark-down> custom element.

<mark-down src="/README.md"></mark-down>

Linking to Pages

To enable SPA-style routing, just wrap links in an <app-link> element. You can set preload="true" if you want the linked page to be pre-fetched as soon as the current page loads.

<app-link><a href="/about">About Us</a></app-link>

Layout

A layout is a custom element containing the site's shared markup. Layouts should include the <app-root> element with a nested <slot> to load the page's content. Here is the default layout included with Ramidus.

<!-- /@/app-layout.js -->
<app-nav></app-nav>

<main>
  <app-root>
    <slot></slot>
  </app-root>
</main>

<app-footer></app-footer>

The layout can be updated dynamically based on the page you are on. When each page loads, the path and current page nesting level are added as classes to the <app-layout> element, i.e. class="about level-2". You can use these classes to style elements inside the layout element. In the template above, if you wanted to hide the footer on pages under the "about" path, you could use the following css in your layout.

:host(.about) app-footer {
  display: none;
}

Components

Global components go in the /@/components folder and are registered in /@/main.js. Ramidus's core components are built with Ardi, but you can use any custom element framework you like (or none).

Deployment

No build step is required to deploy this site: you can copy this project to a simple server and it will run just fine. You will probably still want to run npm run build before you deploy though.

Benefits of Building

  1. The site's head is included with each page instead of being generated when the first page loads.
  2. Building will make it so the first page visited fades in after the globally-registered components have loaded, preventing CLS.

Deployment Settings

Build CommandPublish Directory
npm run builddist
1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.0.26

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago