forked from mmistakes/minimal-mistakes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add banner text to main.min.js (mmistakes#880)
- Add `---` YAML Front Matter as a workaround to allow the theme gem's version to be overridden locally. - Adjust page scope in Front Matter default to avoid adding a layout to `main.min.js` - Fixes mmistakes#874, Fixes mmistakes#722
- Loading branch information
Showing
6 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,21 @@ | ||
const fs = require('fs'); | ||
const pkg = require('./package.json'); | ||
const filename = 'assets/js/main.min.js'; | ||
const script = fs.readFileSync(filename); | ||
const padStart = str => ('0' + str).slice(-2) | ||
const dateObj = new Date; | ||
const date = `${dateObj.getFullYear()}-${padStart(dateObj.getMonth() + 1)}-${padStart(dateObj.getDate())}`; | ||
const banner = `--- | ||
layout: | ||
--- | ||
/*! | ||
* Minimal Mistakes Jekyll Theme ${pkg.version} by ${pkg.author} | ||
* Copyright ${dateObj.getFullYear()} Michael Rose - mademistakes.com | @mmistakes | ||
* Licensed under ${pkg.license} | ||
*/ | ||
`; | ||
|
||
if (script.slice(0, 3) != '/**') { | ||
fs.writeFileSync(filename, banner + script); | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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