mirror of
https://github.com/hacks-guide/minimal-mistakes.git
synced 2024-11-26 18:30:28 +00:00
Consolidate hard-coded version numbers where possible
Now only 4 files left untouchable. Search README.md for "Dev note" for details.
This commit is contained in:
parent
aae8dac76c
commit
8d3592ff70
32
README.md
32
README.md
@ -115,7 +115,7 @@ To install:
|
||||
|
||||
2. Add `jekyll-include-cache` to the `plugins` array of your `_config.yml`.
|
||||
|
||||
3. Fetch and update bundled gems by running the following [Bundler](http://bundler.io/) command:
|
||||
3. Fetch and update bundled gems by running the following [Bundler](https://bundler.io/) command:
|
||||
|
||||
```bash
|
||||
bundle
|
||||
@ -123,14 +123,34 @@ To install:
|
||||
|
||||
4. Add `remote_theme: "mmistakes/minimal-mistakes@4.24.0"` to your `_config.yml` file. Remove any other `theme:` or `remote_theme:` entry.
|
||||
|
||||
<!--
|
||||
Dev note: The version number is currently hard-coded in these files:
|
||||
|
||||
- README.md (this file)
|
||||
- package.json
|
||||
- docs/_config.yml (as theme_version)
|
||||
- docs/_pages/home.md (in Front Matter "excerpt")
|
||||
|
||||
For every release, files listed above should be manually updated with the new version number.
|
||||
|
||||
Additionally, the license year is hard-coded in these files:
|
||||
|
||||
- README.md (this file, near the end)
|
||||
- LICENSE
|
||||
|
||||
The following files should also be regenerated:
|
||||
|
||||
- _includes/copyright.html, _includes/copyright.js, _sass/minimal-mistakes/_copyright.scss
|
||||
(Run `bundle exec rake clean` then `bundle exec rake copyright` - all three references `package.json`)
|
||||
- assets/js/main.min.js (Run `npm run build:js`, references `_includes/copyright.js`)
|
||||
-->
|
||||
|
||||
**Looking for an example?** Use the [Minimal Mistakes remote theme starter](https://github.com/mmistakes/mm-github-pages-starter/generate) for the quickest method of getting a GitHub Pages hosted site up and running. Generate a new repository from the starter, replace sample content with your own, and configure as needed.
|
||||
|
||||
## Usage
|
||||
|
||||
For detailed instructions on how to configure, customize, add/migrate content, and more read the [theme's documentation](https://mmistakes.github.io/minimal-mistakes/docs/quick-start-guide/).
|
||||
|
||||
---
|
||||
|
||||
## Contributing
|
||||
|
||||
Found a typo in the documentation or interested in [fixing a bug](https://github.com/mmistakes/minimal-mistakes/issues)? Then by all means [submit an issue](https://github.com/mmistakes/minimal-mistakes/issues/new) or [pull request](https://help.github.com/articles/using-pull-requests/). If this is your first pull request, it may be helpful to read up on the [GitHub Flow](https://guides.github.com/introduction/flow/) first.
|
||||
@ -153,8 +173,6 @@ To set up your environment to develop this theme, run `bundle install`.
|
||||
|
||||
To test the theme, run `bundle exec rake preview` and open your browser at `http://localhost:4000/test/`. This starts a Jekyll server using content in the `test/` directory. As modifications are made to the theme and test site, it will regenerate and you should see the changes in the browser after a refresh.
|
||||
|
||||
---
|
||||
|
||||
## Credits
|
||||
|
||||
### Creator
|
||||
@ -167,7 +185,7 @@ To test the theme, run `bundle exec rake preview` and open your browser at `http
|
||||
|
||||
### Icons + Demo Images:
|
||||
|
||||
- [The Noun Project](https://thenounproject.com) -- Garrett Knoll, Arthur Shlain, and [tracy tam](https://thenounproject.com/tracytam)
|
||||
- [The Noun Project](https://thenounproject.com) - Garrett Knoll, Arthur Shlain, and [tracy tam](https://thenounproject.com/tracytam)
|
||||
- [Font Awesome](http://fontawesome.io/)
|
||||
- [Unsplash](https://unsplash.com/)
|
||||
|
||||
@ -185,8 +203,6 @@ To test the theme, run `bundle exec rake preview` and open your browser at `http
|
||||
- [jQuery throttle / debounce](http://benalman.com/projects/jquery-throttle-debounce-plugin/)
|
||||
- [Lunr](http://lunrjs.com)
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
43
Rakefile
43
Rakefile
@ -1,9 +1,13 @@
|
||||
require "bundler/gem_tasks"
|
||||
require "jekyll"
|
||||
require "json"
|
||||
require "listen"
|
||||
require "rake/clean"
|
||||
require "time"
|
||||
require "yaml"
|
||||
|
||||
package_json = JSON.parse(File.read("package.json"))
|
||||
|
||||
def listen_ignore_paths(base, options)
|
||||
[
|
||||
/_config\.ya?ml/,
|
||||
@ -101,3 +105,42 @@ file "docs/_docs/18-history.md" => "CHANGELOG.md" do |t|
|
||||
f.puts "{% endraw %}"
|
||||
end
|
||||
end
|
||||
|
||||
COPYRIGHT_LINES = [
|
||||
"Minimal Mistakes Jekyll Theme #{package_json["version"]} by Michael Rose",
|
||||
"Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes",
|
||||
"Free for personal and commercial use under the MIT license",
|
||||
"https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE",
|
||||
]
|
||||
|
||||
COPYRIGHT_FILES = [
|
||||
"_includes/copyright.html",
|
||||
"_includes/copyright.js",
|
||||
"_sass/minimal-mistakes/_copyright.scss",
|
||||
]
|
||||
|
||||
def genenerate_copyright_file(filename, header, prefix, footer)
|
||||
File.open(filename, "w") do |f|
|
||||
f.puts header
|
||||
COPYRIGHT_LINES.each do |line|
|
||||
f.puts "#{prefix}#{line}"
|
||||
end
|
||||
f.puts footer
|
||||
end
|
||||
end
|
||||
|
||||
file "_includes/copyright.html" do |t|
|
||||
genenerate_copyright_file(t.name, "<!--", " ", "-->")
|
||||
end
|
||||
|
||||
file "_includes/copyright.js" do |t|
|
||||
genenerate_copyright_file(t.name, "/*!", " * ", " */")
|
||||
end
|
||||
|
||||
file "_sass/minimal-mistakes/_copyright.scss" do |t|
|
||||
genenerate_copyright_file(t.name, "/*!", " * ", " */")
|
||||
end
|
||||
|
||||
task :copyright => COPYRIGHT_FILES
|
||||
|
||||
CLEAN.include(*COPYRIGHT_FILES)
|
||||
|
6
_includes/copyright.html
Normal file
6
_includes/copyright.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!--
|
||||
Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
Free for personal and commercial use under the MIT license
|
||||
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
-->
|
6
_includes/copyright.js
Normal file
6
_includes/copyright.js
Normal file
@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
* Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
* Free for personal and commercial use under the MIT license
|
||||
* https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
*/
|
@ -2,12 +2,7 @@
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<!--
|
||||
Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
Free for personal and commercial use under the MIT license
|
||||
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
-->
|
||||
{% include "copyright.html" %}
|
||||
<html lang="{{ site.locale | slice: 0,2 | default: "en" }}" class="no-js">
|
||||
<head>
|
||||
{% include head.html %}
|
||||
|
@ -1,8 +1,5 @@
|
||||
/*!
|
||||
* Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
* Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
* Licensed under MIT (https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE)
|
||||
*/
|
||||
/* Copyright comment */
|
||||
@import "minimal-mistakes/copyright";
|
||||
|
||||
/* Variables */
|
||||
@import "minimal-mistakes/variables";
|
||||
|
6
_sass/minimal-mistakes/_copyright.scss
Normal file
6
_sass/minimal-mistakes/_copyright.scss
Normal file
@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
* Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
* Free for personal and commercial use under the MIT license
|
||||
* https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
*/
|
18
banner.js
18
banner.js
@ -1,19 +1,7 @@
|
||||
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 = `/*!
|
||||
* Minimal Mistakes Jekyll Theme ${pkg.version} by ${pkg.author}
|
||||
* Copyright 2013-${dateObj.getFullYear()} Michael Rose - mademistakes.com | @mmistakes
|
||||
* Licensed under ${pkg.license}
|
||||
*/
|
||||
`;
|
||||
const script = fs.readFileSync("assets/js/main.min.js");
|
||||
const banner = fs.readFileSync("_includes/copyright.js");
|
||||
|
||||
if (script.slice(0, 3) != "/**") {
|
||||
if (script.slice(0, 3) != "/*!") {
|
||||
fs.writeFileSync(filename, banner + script);
|
||||
}
|
||||
|
@ -5,7 +5,8 @@
|
||||
# For technical reasons, this file is *NOT* reloaded automatically when you use
|
||||
# `jekyll serve`. If you change this file, please restart the server process.
|
||||
|
||||
remote_theme : "mmistakes/minimal-mistakes@4.24.0"
|
||||
remote_theme : "mmistakes/minimal-mistakes@master"
|
||||
theme_version : "4.24.0"
|
||||
|
||||
minimal_mistakes_skin : "default" # "air", "aqua", "contrast", "dark", "dirt", "neon", "mint", "plum", "sunrise"
|
||||
|
||||
|
@ -78,7 +78,7 @@ To install as a remote theme:
|
||||
bundle
|
||||
```
|
||||
|
||||
4. Add `remote_theme: "mmistakes/minimal-mistakes@4.24.0"` to your `_config.yml` file. Remove any other `theme:` or `remote_theme:` entry.
|
||||
4. Add `remote_theme: "mmistakes/minimal-mistakes@{{ site.theme_version }}"` to your `_config.yml` file. Remove any other `theme:` or `remote_theme:` entry.
|
||||
|
||||
You may also optionally specify a branch, [tag](https://github.com/mmistakes/minimal-mistakes/tags), or commit to use by appending an @ and the Git ref (e.g., `mmistakes/minimal-mistakes@4.9.0` or `mmistakes/minimal-mistakes@bbf3cbc5fd64a3e1885f3f99eb90ba92af84063d`). This is useful when rolling back to older versions of the theme. If you don't specify a Git ref, the latest on `master` will be used.
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
title: "Upgrading"
|
||||
permalink: /docs/upgrading/
|
||||
excerpt: "Instructions and suggestions for upgrading the theme."
|
||||
last_modified_at: 2021-06-23T08:15:34-04:00
|
||||
last_modified_at: 2024-04-23T00:43:19+08:00
|
||||
toc: true
|
||||
---
|
||||
|
||||
@ -10,13 +10,8 @@ If you're using the [Ruby Gem]({{ "/docs/quick-start-guide/#gem-based-method" |
|
||||
|
||||
To check which version you are currently using, view the source of your built site and you should see something similar to:
|
||||
|
||||
```
|
||||
<!--
|
||||
Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
Free for personal and commercial use under the MIT license
|
||||
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
-->
|
||||
```text
|
||||
{% include "copyright.html" %}
|
||||
```
|
||||
|
||||
At the top of every `.html` file, `/assets/css/main.css`, and `/assets/js/main.min.js`.
|
||||
@ -28,14 +23,14 @@ Simply run `bundle update` if you're using Bundler (have a `Gemfile`) or `gem up
|
||||
When using Bundler you can downgrade or lock the theme to a specific release ([tag](https://github.com/mmistakes/minimal-mistakes/tags)), branch, or commit. Instead of `gem "minimal-mistakes-jekyll"` you'd add the following to your `Gemfile`:
|
||||
|
||||
```ruby
|
||||
gem "minimal-mistakes-jekyll", :git => "https://github.com/mmistakes/minimal-mistakes.git", :tag => "4.24.0"
|
||||
gem "minimal-mistakes-jekyll", :git => "https://github.com/mmistakes/minimal-mistakes.git", :tag => "{{ site.theme_version }}"
|
||||
```
|
||||
|
||||
For more information on [installing gems from git repositories](http://bundler.io/v1.16/guides/git.html) consult Bundler's documentation.
|
||||
|
||||
## Remote theme
|
||||
|
||||
When setting `remote_theme: "mmistakes/minimal-mistakes@4.24.0"` in your `_config.yml` you may also optionally specify a branch, [tag](https://github.com/mmistakes/minimal-mistakes/tags), or commit to use by appending an @ and the Git ref.
|
||||
When setting `remote_theme: "mmistakes/minimal-mistakes@{{ site.theme_version }}"` in your `_config.yml` you may also optionally specify a branch, [tag](https://github.com/mmistakes/minimal-mistakes/tags), or commit to use by appending an @ and the Git ref.
|
||||
|
||||
For example you can roll back to release 4.8.1 with `mmistakes/minimal-mistakes@4.8.1` or a specific commit with `mmistakes/minimal-mistakes@bbf3cbc5fd64a3e1885f3f99eb90ba92af84063d`). For a complete list of theme versions consult the [releases page](https://github.com/mmistakes/minimal-mistakes/releases).
|
||||
|
||||
|
@ -2,12 +2,7 @@
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<!--
|
||||
Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
|
||||
Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
|
||||
Free for personal and commercial use under the MIT license
|
||||
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
-->
|
||||
{% include "copyright.html" %}
|
||||
<html lang="{{ site.locale | slice: 0,2 | default: "en" }}" class="no-js">
|
||||
<head>
|
||||
{% include head.html %}
|
||||
|
@ -1,9 +1,11 @@
|
||||
# coding: utf-8
|
||||
require "json"
|
||||
|
||||
package_json = JSON.parse(File.read("package.json"))
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "minimal-mistakes-jekyll"
|
||||
spec.version = "4.24.0"
|
||||
spec.authors = ["Michael Rose"]
|
||||
spec.version = package_json["version"]
|
||||
spec.authors = ["Michael Rose", "iBug"]
|
||||
|
||||
spec.summary = %q{A flexible two-column Jekyll theme.}
|
||||
spec.homepage = "https://github.com/mmistakes/minimal-mistakes"
|
||||
|
@ -5,7 +5,7 @@
|
||||
"description": "Minimal Mistakes 2 column Jekyll theme.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mmistakes/minimal-mistakes.git"
|
||||
"url": "https://github.com/mmistakes/minimal-mistakes.git"
|
||||
},
|
||||
"keywords": [
|
||||
"jekyll",
|
||||
|
Loading…
Reference in New Issue
Block a user