EleventyOne

一个快速入门用 Eleventy SSG 建造的脚手架。「A scaffold for a quick start building with the Eleventy SSG.」

Github stars Tracking Chart

EleventyOne

Phil 使用 Eleventy 开始另一个项目时的首选。

这个项目脚手架包括:

  • Eleventy 与一个骨架网站。
  • 基于 Luxon 的 Nunjucks 日期格式过滤器
  • 使用 PostCSS 的小型 CSS pipeline
  • 一个小小的内联 JS 管道
  • JS 搜索索引生成器
  • 用于测试 Netlify 重定向的 Netlify Dev
  • 使用 Netlify DevNetlify Functions 的无服务器(FaaS)开发管道。

说明

要想快速克隆这个 11ty 启动项目的实例并部署到 Netlify,只需点击下面的按钮并按照说明操作即可。

Deploy to Netlify

等等,当我点击那个按钮时会发生什么?

问得好!下面是它会做的事情...

  1. Netlify 会把这个项目的 git 仓库克隆到你的 Github 账户中。它将会请求允许你添加这个仓库。
  2. 我们将在 Netlify 中为你创建一个新的站点,并配置它来使用你的新仓库。马上,你就可以通过推送变化到你的 repo 来部署变化了。
  3. 就是这样。

先决条件

本地运行

# install the dependencies
npm install
# External data sources can be stashed locally
npm run seed
# It will then be available locally for building with
npm run start

添加一些 Netlify 助手

Netlify Dev 增加了使用 Netlify 重定向、代理和无服务器功能的能力。

# 安装 Netlify CLI 以获得 Netlify Dev 的功能
npm install -g netlify-cli
# 运行一个本地服务器,在 Eleventy 前面添加一些 Netlify 糖
netlify dev

通过 Netlify Dev 包含了一个无服务器功能管道。通过运行 netlify dev,你可以直接执行你的任何 serverless 函数,就像这样:

  • /.netlify/functions/hello
  • /.netlify/functions/fetch-joke

重定向和代理

Netlify 的重定向 API 可以提供更友好的 URL 作为这些 URL 的代理:

  • /api/hello
  • /api/fetch-joke


(The first version translated by vz on 2020.12.19)

Overview

Name With Ownerphilhawksworth/eleventyone
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 3)
PlatformLinux, Mac, Windows
License:MIT License
Release Count2
Last Release Namev3.0.0 (Posted on )
First Release Namev2.0.0 (Posted on )
Created At2018-03-30 19:45:51
Pushed At2024-03-25 14:14:26
Last Commit At2021-01-18 11:29:03
Stargazers Count464
Watchers Count11
Fork Count112
Commits Count66
Has Issues Enabled
Issues Count12
Issue Open Count4
Pull Requests Count10
Pull Requests Open Count13
Pull Requests Close Count15
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

EleventyOne

Netlify Status

Phil's first port of call when starting another project using Eleventy.

This project scaffold includes:

Eleventy screenshot

Instructions

To get your own instance of this 11ty starter project cloned and deploying to Netlify very quickly, just click the button below and follow the instructions.

Deploy to Netlify

Wait, what happens when I click that button?

Good question. Here's what it will do...

  1. Netlify will clone the git repository of this project into your Github account. It will be asking for permission to add the repo for you.
  2. We'll create a new site for you in Netlify, and configure it to use your shiny new repo. Right away you'll be able to deploy changes simply by pushing changes to your repo.
  3. That's it really.

Prerequisites

Running locally

# install the dependencies
npm install

# External data sources can be stashed locally
npm run seed

# It will then be available locally for building with
npm run start

Add some Netlify helpers

Netlify Dev adds the ability to use Netlify redirects, proxies, and serverless functions.

# install the Netlify CLI in order to get Netlify Dev
npm install -g netlify-cli

# run a local server with some added Netlify sugar in front of Eleventy
netlify dev

A serverless functions pipeline is included via Netlify Dev. By running netlify dev you'll be able to execute any of your serverless functions directly like this:

  • /.netlify/functions/hello
  • /.netlify/functions/fetch-joke

Redirects and proxies

Netlify's Redirects API can provide friendlier URLs as proxies to these URLs.

  • /api/hello
  • /api/fetch-joke
To the top