From 69aafde6291d2543e0a188ad4d9e1f15bcacb66c Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Thu, 6 Jun 2024 11:57:15 -0400 Subject: [PATCH] update meta files docs and usage examples --- www/pages/docs/configuration.md | 4 ++-- www/pages/docs/css-and-images.md | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/www/pages/docs/configuration.md b/www/pages/docs/configuration.md index 1575d5013..2b0a2b85a 100644 --- a/www/pages/docs/configuration.md +++ b/www/pages/docs/configuration.md @@ -239,7 +239,7 @@ export default { ``` ### Workspace -Path to where all your project files will be located. Using an absolute path is recommended. +Path to where all your project files will be located. Using an absolute path is recommended. Default is _src/_. #### Example @@ -251,4 +251,4 @@ export default { }; ``` -> Please note the trailing `/` here as for ESM, a path must end in a `/` for directories. \ No newline at end of file +> Please note the trailing `/` here as for ESM, as paths must end in a `/` for directories. \ No newline at end of file diff --git a/www/pages/docs/css-and-images.md b/www/pages/docs/css-and-images.md index b3cddb271..6833bff5c 100644 --- a/www/pages/docs/css-and-images.md +++ b/www/pages/docs/css-and-images.md @@ -108,18 +108,21 @@ customElements.define('x-header', HeaderComponent); > ``` -### Meta files +### Meta Files -The build includes a few [default copy plugins](https://github.com/ProjectEvergreen/greenwood/tree/master/packages/cli/src/plugins/copy) for common meta files. Typically, they support copying the files from the source directory to the build directory. +By default, Greenwood will automatically detect these "meta" files from the top-level of your [workspace directory](docs/configuration/#workspace) and automatically copy them over to the root of the build output directory. -* `plugin-copy-favicon.js` - copies favicon.ico. NOTE: Does not support multiple favicons. For multiple support, use the manifest.json or make a custom plugin -* `plugin-copy-manifest-json.js` - copies manifest.json -* `plugin-copy-robots.js` - copies robots.txt -* `plugin-copy-sitemap.js` - copies sitemap.xml +- _favicon.ico_ +- _robots.txt_ +- _sitemap.xml_ -If you need to generate these files dynamically, build a custom copy plugin. The [build.default.meta-files.spec.js](https://github.com/ProjectEvergreen/greenwood/blob/master/packages/cli/test/cases/build.default.meta-files/build.default.meta-files.spec.js) is a good example of how to test. The test lifecycle is: +Example: -* Read config -* Build site using fixtures (fake files) in the test directory -* Assert the copy executed properly +```shell +src/ + favicon.ico + robots.txt + sitemap.xml +``` +> If you need support for more custom copying of static files like this, please check out our docs on creating your own [copy plugin](plugins/copy/).