What's on this page
Server and optimization
These options configure the local preview server and the optimization of the generated files.
Server
server.headers
You can define custom HTTP headers, used by the local preview server.
server:
headers:
- path: <path> # Relative path, prefixed with a slash. Support "*" wildcard.
headers:
- key: <key>
value: "<value>"
Example:
server:
headers:
- path: /*
headers:
- key: X-Frame-Options
value: "SAMEORIGIN"
- key: X-XSS-Protection
value: "1; mode=block"
- key: X-Content-Type-Options
value: "nosniff"
- key: Content-Security-Policy
value: "default-src 'self'; object-src 'self'; img-src 'self'"
- key: Strict-Transport-Security
value: "max-age=31536000; includeSubDomains; preload"
- path: /assets/*
headers:
- key: Cache-Control
value: "public, max-age=31536000"
- path: /foo.html
headers:
- key: Foo
value: "bar"
Optimize
The optimization options allow to enable compression of output files: HTML, CSS, JavaScript and image.
optimize:
enabled: false # enables files optimization (`false` by default)
html:
enabled: true # enables HTML files optimization
ext: [html, htm] # supported files extensions
css:
enabled: true # enables CSS files optimization
ext: [css] # supported files extensions
js:
enabled: true # enables JavaScript files optimization
ext: [js] # supported files extensions
images:
enabled: true # enables images files optimization
ext: [jpeg, jpg, png, gif, webp, svg, avif] # supported files extensions
This option is disabled by default and can be enabled via:
optimize: true
Once the global option is enabled, the 4 file types will be processed.
It is possible to disable each of them via enabled: false and modify processed files extension via ext.