Skip to content

Commit

Permalink
ad headers file for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Gardner committed Mar 11, 2022
1 parent b716904 commit e472964
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
resources/
5 changes: 5 additions & 0 deletions _headers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/css/*
Cache-Control: public, max-age=14400

/img/*
Cache-Control: public, max-age=604800
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"scripts": {
"build": "eleventy",
"postbuild": "postcss _site/css/*.css -u autoprefixer cssnano -r --no-map",
"postbuild": "postcss _site/css/*.css -u autoprefixer cssnano -r --no-map && node resources/tooling/copy-files.js",
"watch": "eleventy --watch",
"serve": "eleventy --serve",
"start": "eleventy --serve",
Expand Down
31 changes: 31 additions & 0 deletions resources/tooling/copy-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const fs = require('fs');
const path = require('path');

const files = [
{
src: path.join(
__dirname,
'..',
'..',
'_headers.txt'
),
dest: path.join(
__dirname,
'..',
'..',
'_site',
'_headers'
),
},
];

files.forEach((file) => {
let src = file.src;
let dest = file.dest;
if (fs.existsSync(src)) {
fs.copyFile(src, dest, function (err) {
if (err) throw err;
console.log(src, 'was copied to', dest);
});
}
});

0 comments on commit e472964

Please sign in to comment.