npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@halfgray/grayspace

v0.5.2

Published

Minimal theme integration for Astro

Downloads

3

Readme

Grayspace

Grayspace is a theme integration for the Astro website framework. It is a fairly minimal theme, originally designed for the website of the Half-Gray Association.

Installation

  1. Set up Astro: Refer to the Astro docs for more information

  2. Install Grayspace:

    npm install --save @halfgray/grayspace
  3. Add the integration to your Astro configuration file:

    // ...
    import grayspace from '@halfgray/grayspace';
    
    export default defineConfig({
    	//...
    
    	integrations: [
    		grayspace({
    			// Configure site-wide options
    			// Refer to Configuration section for more options
    			siteName: 'My Site',
    			siteStyles: ['./src/styles/site-styles.css', '@fontsource/open-sans'],
    		}),
    	],
    
    	// Adding i18n config is highly recommended, even if your site is monolingual
    	i18n: {
    		defaultLocale: 'en',
    		locales: ['en'],
    	},
    });

Usage

Grayspace comes with a few common layouts for pages. You can use them directly in .astro pages or in Markdown.

These layouts are exported as @halfgray/grayspace/layouts/[layout]:

  • HomeLayout: For the homepage, with a large header for the site name and logo
  • ArticleLayout: For most "singular" pages on the site, with a smaller header linking to the homepage and a page title
    • Required props: title (can be set directly or through Markdown frontmatter)
  • GeneralLayout: Generic layout for navigation or other purposes
    • Required props: title (can be set directly or through Markdown frontmatter)

Example:

---
import ArticleLayout from '@halfgray/grayspace/layouts/ArticleLayout`;
---

<ArticleLayout title="My Page">
	<p>My page content</p>
</ArticleLayout>

Or in Markdown:

---
layout: '@halfgray/grayspace/layouts/ArticleLayout'
title: 'My Page'
---

My page content

Configuration

The integration accepts the following options:

  • siteName: (string, required) Name of your site
  • siteLogo: (string, optional) Path to site logo (note that this is a raw path to be included in the HTML, so placing the logo in public/ is recommended)
  • favicon: (string, optional) Path to favicon (defaults to using the site logo)
  • siteStyles: (string[], optional) Custom CSS imports, either a path to a local file (starting with .) or a package name
  • homeLink: (string, optional) URL to homepage for the link in the header (defaults to the configured base path)

In addition, it is highly recommended that you specify the locale in Astro's i18n configuration, even if your site is monolingual. This helps specify the language of the page for accessibility.

Example:

i18n: {
	defaultLocale: 'en',
	locales: ['en'], // Somewhat redundant for a monolingual site, but required by Astro
}

Customization

If you want to customize your pages, you can create your own layouts based on the ones provided. Each layout provides the following named slots:

  • head: Additional metadata to add to the <head> element
  • header: Additional contents to add to the <header> after the homepage link
  • footer: Contents to add to the <footer>

For even more customization, Grayspace provides a component library to build your own pages. This library does not require installing the integration on your site.

The component library is exported under @halfgray/grayspace/components.

Example:

---
import { BasePage, SiteId } from '@halfgray/grayspace/components';
import CustomComponent from '../components/CustomComponent.astro';
---

<BasePage lang="en" title="My Custom Page" skipToMainText="Skip to main">
	<SiteId slot="header" name="My Site" link="/" />
	<h1>My Custom Page</h1>
	<CustomComponent />
</BasePage>

License

Grayspace is available under the MIT License. Refer to LICENSE.txt for details.