-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7b7d2db
Showing
15 changed files
with
9,086 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
const htmlmin = require('html-minifier'); | ||
|
||
// Generate the shortened commit hash and create (overwrite) `build_info.json` | ||
// file. This file will eventually be added to the footer of the page. | ||
const writeBuildInfoToFile = () => { | ||
const version = require('./package.json').version; | ||
const commitHash = require('child_process') | ||
.execSync('git rev-parse --short HEAD').toString().trim(); | ||
const commitDate = require('child_process') | ||
.execSync('git show -s --format=%cd --date=short').toString().trim(); | ||
const currentYear = (new Date()).getFullYear(); | ||
const jsonData = JSON.stringify({ | ||
version: version, | ||
revision: commitHash, | ||
lastUpdated: commitDate, | ||
copyrightYear: currentYear | ||
}); | ||
const fs = require('fs'); | ||
fs.writeFileSync('src/_data/build_info.json', jsonData); | ||
}; | ||
|
||
const htmlMinifierCallback = (content, outputPath) => { | ||
if (outputPath.endsWith('.html')) { | ||
let minified = htmlmin.minify(content, { | ||
useShortDoctype: true, | ||
removeComments: true, | ||
collapseWhitespace: true, | ||
}); | ||
return minified; | ||
} | ||
return content; | ||
}; | ||
|
||
module.exports = function(eleventyConfig) { | ||
eleventyConfig.setUseGitIgnore(false); | ||
|
||
writeBuildInfoToFile(); | ||
|
||
if (process.env.ELEVENTY_ENV === 'production') { | ||
eleventyConfig.addTransform('htmlminifier', htmlMinifierCallback); | ||
} else { | ||
eleventyConfig.setBrowserSyncConfig({}); | ||
} | ||
|
||
// eleventyConfig.addWatchTarget('./scripts/*.js'); | ||
eleventyConfig.addWatchTarget('./src/styles/styles.css'); | ||
|
||
// eleventyConfig.addPassthroughCopy('src/scripts'); | ||
eleventyConfig.addPassthroughCopy('src/style.css'); | ||
// eleventyConfig.addPassthroughCopy('src/media'); | ||
// eleventyConfig.addPassthroughCopy('src/favicon'); | ||
// eleventyConfig.addPassthroughCopy('src/robots.txt'); | ||
// eleventyConfig.addPassthroughCopy('src/sitemap.xml'); | ||
|
||
return { | ||
dir: {input: 'src'} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Package Maintenance (04/29/2022) | ||
|
||
brew doctor | ||
brew update --verbose | ||
brew upgrade | ||
brew doctor && brew cleanup |
Oops, something went wrong.