@nuxtjs/netlify-files
Nuxt module to create new _headers and _redirects files for Netlify or to use existing ones
Setup
- Add
@nuxtjs/netlify-files
dependency to your project
yarn add --dev @nuxtjs/netlify-files # or npm install --save-dev @nuxtjs/netlify-files
- Add
@nuxtjs/netlify-files
to thebuildModules
section ofnuxt.config.js
export default {
buildModules: [
// Simple usage
'@nuxtjs/netlify-files',
// With options
['@nuxtjs/netlify-files', { /* module options */ }]
]
}
dependency
(No --dev
or --save-dev
flags) and use modules
section in nuxt.config.js
instead of buildModules
.
Using top level options
export default {
buildModules: [
'@nuxtjs/netlify-files'
],
netlifyFiles: {
/* module options */
}
}
Options
copyExistingFiles
- Type:
Boolean
- Default:
true
Enable/disable copying of existing files.
existingFilesDirectory
- Type:
String
- Default:
srcDir
The directory where your _headers and _redirects file is located.
Usage
Currently, the module will look for _headers
and _redirects
files and will copy into the generate folder
(default: dist
) after static generation. If you have them directly in your project folder, you don't have to do
anything else. In case the files are somewhere else you can configure the directory (see below)
export default {
netlifyFiles: {
existingFilesDirectory: 'path/to/nuxt/directory', // The directory where your _headers and _redirects file is located
}
}
License
Copyright (c) Nuxt Community