@0x4447/avocado 中文文档教程

发布于 6年前 浏览 31 项目主页 更新于 3年前

Avocado

在创建了有用的 0x4447 Potato 之后???? CLI,我们发现将一个简单的 HTML 页面部署到 AWS CloudFront,一个不围绕框架构建的页面,既烦人又耗时。 这就是为什么我们想出了 Avocado 的想法:一个 CLI,它将通过使用很棒的模板引擎 Hogan 从一个简单的文件夹结构中构建最终页面。

How to Install

] sudo npm install -g @0x4447/avocado

How to Use

] avocado -s PATH_TO_FOLDER

Where to get Help

] avocado -h

What to Expect

  • Removes the _preview and _output folder, this way we have a clean slate.
  • Creates empty _preview and _output folder.
  • Reads the JSON files from the data folder.
  • Reads the JSON files from the env.json file.
  • Merge the two data sets together.
  • Renders the final page using Hogan.
  • Save the result in the _preview and _output folder.

Folder Structure of the Source Site

根文件夹将包含站点内容所在的 _input 文件夹。 dataviews 文件夹包含用于生成预览和最终输出的数据和 HTML 文件。

  • Root
  • _input/
  • assets/ - all your images, js, css and other.
  • data/ - JSON files for each page from the view folder to enrich the page using Hogan.
  • views/ - all pages in HTML form which can be organized using sub folders.
  • any file to be included in the final page.
  • env.json - a JSON file that holds the environment variables that are uniquer per page deployment, and should not committed to the repository. Worth knowing: use the help option to find out how to pass different env file.

如果您想试用 Avocado,可以查看我们的公司网站资源库以供参考。

How to deliver the site locally

如果您只有一个页面,则可以通过打开单个 HTML 文件轻松检查该页面。 但是,如果您想使用自定义本地域和自签名 SSL 证书进行本地设置,您可以 检查我们使用的配置

Companion Software

此 CLI 工具也适用于以下软件:

  • Potato: it helps you host and upload your work on to AWS S3 and deliver the site through AWS CloudFront.
  • Broccoli: it helps you create a Nginx configuration to work one the site from your local machine.

The End

如果您喜欢这个项目,请考虑给它一个 ????。 并查看我们的 0x4447 GitHub 帐户,我们在其中提供您可能会觉得有用或有趣的其他资源。

该项目由 0x4447 LLC 提供,这是一家专门在 AWS 上构建自定义解决方案的软件公司。 通过以下链接了解更多信息:https://0x4447.com 或者说 hello@0x4447.email

???? Avocado

After having created the useful 0x4447 Potato ???? CLI, we found that deploying a simple HTML page to AWS CloudFront, a page that is not build around a framework, is annoying and time consuming. This is why we came up with the idea for Avocado: a CLI that will build the final page out of a simple folder structure by using the awesome templating engine–Hogan.

How to Install

] sudo npm install -g @0x4447/avocado

How to Use

] avocado -s PATH_TO_FOLDER

Where to get Help

] avocado -h

What to Expect

  • Removes the _preview and _output folder, this way we have a clean slate.
  • Creates empty _preview and _output folder.
  • Reads the JSON files from the data folder.
  • Reads the JSON files from the env.json file.
  • Merge the two data sets together.
  • Renders the final page using Hogan.
  • Save the result in the _preview and _output folder.

Folder Structure of the Source Site

The root folder will contain the _input folder where the content of the site is located. The data, and views folders holds the data and the HTML files which are used to generate the previews and final output.

  • Root
  • _input/
  • assets/ - all your images, js, css and other.
  • data/ - JSON files for each page from the view folder to enrich the page using Hogan.
  • views/ - all pages in HTML form which can be organized using sub folders.
  • any file to be included in the final page.
  • env.json - a JSON file that holds the environment variables that are uniquer per page deployment, and should not committed to the repository. Worth knowing: use the help option to find out how to pass different env file.

If you'd like to try out Avocado, you can take a look at our company website repository for reference.

How to deliver the site locally

If you have just a single page it is easy to check the page by opening the individual HTML file. But if you'd like to have a local setup with a custom local domain and a self signed SSL cert, you can check our configuration that we use.

Companion Software

This CLI tools works well also with the following software:

  • Potato: it helps you host and upload your work on to AWS S3 and deliver the site through AWS CloudFront.
  • Broccoli: it helps you create a Nginx configuration to work one the site from your local machine.

The End

If you enjoyed this project, please consider giving it a ????. And check out our 0x4447 GitHub account, where we have additional resources that you might find useful or interesting.

This project is brought to you by 0x4447 LLC, a software company specializing in build custom solutions on top of AWS. Find out more by following this link: https://0x4447.com or, say hello@0x4447.email.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文