Skip to content

Commit

Permalink
feat: added a blank nue example project for use with 'create' cli
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpricedev committed Jan 27, 2025
1 parent f650086 commit 0edb491
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/push-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
matrix:
dir: # dirs in "examples" to run build & push process for
- simple-blog
- blank

env:
dir: 'packages/examples/${{ matrix.dir }}/'
Expand Down
3 changes: 3 additions & 0 deletions packages/examples/blank/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.gz
.env
.dist
18 changes: 18 additions & 0 deletions packages/examples/blank/@global/colors.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

:root {

/* slate gray */
--gray-100: #f3f4f6;
--gray-200: #e5e7eb;
--gray-300: #d1d5db;
--gray-500: #6b7280;
--gray-800: #1f2937;
--gray-900: #111827;

/* main color */
--main-500: #3b82f6;
--main-600: #2563eb;

/* special colors */
--marker: #ffff7a;
}
36 changes: 36 additions & 0 deletions packages/examples/blank/@global/layout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* CSS reset */
*, *::before, *::after {
box-sizing: border-box;
}

/* consistent whitespace */
ul, ol ,figure, pre {
margin: 2em 0;
}

/* page layout */
body {
max-width: 1000px;
margin: 0 auto;
padding: max(4rem, 7.5%) 5% 5% 5%;

/* global footer */
> footer {
border-top: 1px solid var(--gray-200);
margin-top: 8rem;
padding-top: 1rem;
text-align: center;

nav {
a {
color: var(--gray-500);
opacity: .8;
text-decoration: none;

&:hover {
opacity: 1;
}
}
}
}
}
3 changes: 3 additions & 0 deletions packages/examples/blank/@global/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<footer>
<navi :items="navigation.footer"/>
</footer>
23 changes: 23 additions & 0 deletions packages/examples/blank/@global/typography.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
body {
font-family: -apple-system, BlinkMacSystemFont, Avenir Next, Segoe UI, Roboto;
}

/* heading and subtitle */
h1 {
letter-spacing: -0.03em;
font-size: clamp(2rem, 5vw, 2.4rem);

&, + p {
line-height: 1.3;
margin: 0 auto .2em;
max-width: 40rem;
text-align: center;
text-wrap: balance;
}

+ p {
font-size: clamp(1em, 5vw, 1.25em);
font-weight: 300;
margin-bottom: 2em;
}
}
15 changes: 15 additions & 0 deletions packages/examples/blank/@library/home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
img {
display: block;
height: auto;
margin: 0 auto 1vw;
width: max(20vw, 10rem);
}

a {
color: var(--main-500);
text-decoration: none;

&:hover {
color: var(--main-600);
}
}
9 changes: 9 additions & 0 deletions packages/examples/blank/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Nue blank website template

A (mostly) blank template for the `nue create` command:

## Links

- [Template tutorial](https://nuejs.org/docs/tutorial.html)

- [Installing Nue](https://nuejs.org/docs/installation.html)
Binary file added packages/examples/blank/img/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/examples/blank/img/logomark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/examples/blank/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Welcome
include: ['home']
---

![Nue Logo](/img/logomark.png)

# Welcome to [Nue](https://nuejs.org/)

This is a blank Nue project that you can use as a starting point for your own website.
20 changes: 20 additions & 0 deletions packages/examples/blank/site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# yaml-language-server: $schema=https://json.schemastore.org/nuejs-site.json

globals: ['@global']
libs: ['@library']

native_css_nesting: true
inline_css: true
sections: true

title_template: 'Nue / %s'
author: Nue
favicon: /img/favicon.png
description: A (mostly) blank Nue project
port: 8083

navigation:
footer:
- © Nue: https://nuejs.org/
target: _blank
rel: noopener noreferrer
8 changes: 4 additions & 4 deletions packages/nuekit/src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { join } from 'node:path'
import { openUrl } from './util.js'
import { createKit } from './nuekit.js'


async function serve(root, port, debug) {
const nue = await createKit({ root, port })
const terminate = await nue.serve()
Expand All @@ -22,8 +21,10 @@ export async function create({ root, name = 'simple-blog', port }) {
const debug = name == 'test'
if (debug) name = 'simple-blog'

// currently only simple-blog is available
if (name != 'simple-blog') return console.error(`Template "${name}" does not exist`)
// currently only 'simple-blog' and 'blank' are available
if (!['simple-blog', 'blank'].includes(name)) {
return console.error(`Template "${name}" does not exist`)
}

if (existsSync(root)) {
// read files
Expand All @@ -34,7 +35,6 @@ export async function create({ root, name = 'simple-blog', port }) {

// must be empty directory
if (files.length) return console.error('Please create the template to an empty directory')

} else await fs.mkdir(root, { recursive: true })

// download archive
Expand Down

0 comments on commit 0edb491

Please sign in to comment.