Skip to content

Commit

Permalink
Convert readme to the new format
Browse files Browse the repository at this point in the history
  • Loading branch information
Munter committed Apr 6, 2020
1 parent 3fd1a02 commit 700b692
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 56 deletions.
42 changes: 18 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ Relevant files that need to retain their names are not moved:

## Installation

```
npm install --save-dev netlify-plugin-hashfiles
```

Then add the following to your `netlify.yml`:
To install, add the following lines to your `netlify.toml` file:

```yml
plugins:
- type: netlify-plugin-hashfiles
```toml
[[plugins]]
package = "netlify-plugin-hashfiles"
```

_The `[[plugins]]` line is required for each plugin, even if you have other plugins in your `netlify.toml` file already._

**IMPORTANT NOTE:** Hashing files has to be the last thing you do before deploying. Make sure you add hashfiles at the bottom of your plugin configuration.

## Configuration
Expand All @@ -40,22 +38,18 @@ Hashfiles works out of the box, but can be improved upon with some improved know

These are the configuration options with their default values:

```yml
plugins:
- type: netlify-plugin-hashfiles
config:
# An array of glob patterns for pages on your site
# Recursive traversal will start from these
entryPoints:
- "*.html"

# Directory where content-addressable files are moved
staticDir: /static/

# canonicalRoot is the origin where your page will eventually be deployed
# Setting canonicalRoot will enable hashfiles to map canonical URL's to your
# page in your code to local files on disk
canonicalRoot: https://your-page.netlify.com
```toml
[[plugins]]
package = "netlify-plugin-hashfiles"

[plugins.inputs]
# An array of glob patterns for pages on your site. Recursive traversal will start from these
entryPoints = [
"*.html"
]

# Directory where content-addressable files are moved and immutable cache-headers are set
staticDir = "/static/"
```

## License
Expand Down
27 changes: 0 additions & 27 deletions lib/config.schema.json

This file was deleted.

5 changes: 0 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ const appendFile = promisify(require('fs').appendFile);
const deleteFile = promisify(require('fs').unlink);
const AssetGraph = require('assetgraph');
const hashfiles = require('assetgraph-hashfiles');
const configSchema = require('./config.schema.json');

const excludedRelationTypes = ['JavaScriptFetch'];

const canonicalRoot = process.env.URL;

module.exports = {
name: 'hashfiles',

config: configSchema,

onPostBuild: async ({
constants: { BUILD_DIR },
pluginConfig: { entryPoints, staticDir }
Expand Down

0 comments on commit 700b692

Please sign in to comment.