diff --git a/README.md b/README.md index 0f835e00..4473acaf 100644 --- a/README.md +++ b/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. + + **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) diff --git a/Rakefile b/Rakefile index c02d87c6..fea95c2f 100644 --- a/Rakefile +++ b/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) diff --git a/_includes/copyright.html b/_includes/copyright.html new file mode 100644 index 00000000..2780262e --- /dev/null +++ b/_includes/copyright.html @@ -0,0 +1,6 @@ + diff --git a/_includes/copyright.js b/_includes/copyright.js new file mode 100644 index 00000000..0d54edec --- /dev/null +++ b/_includes/copyright.js @@ -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 + */ diff --git a/_layouts/default.html b/_layouts/default.html index fc6beea0..4da4d125 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -2,12 +2,7 @@ --- - +{% include "copyright.html" %} {% include head.html %} diff --git a/_sass/minimal-mistakes.scss b/_sass/minimal-mistakes.scss index 3b252e56..ba9d13d5 100644 --- a/_sass/minimal-mistakes.scss +++ b/_sass/minimal-mistakes.scss @@ -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"; diff --git a/_sass/minimal-mistakes/_copyright.scss b/_sass/minimal-mistakes/_copyright.scss new file mode 100644 index 00000000..0d54edec --- /dev/null +++ b/_sass/minimal-mistakes/_copyright.scss @@ -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 + */ diff --git a/banner.js b/banner.js index db3974c0..78611daa 100644 --- a/banner.js +++ b/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); } diff --git a/docs/_config.yml b/docs/_config.yml index 6cba47ff..2a70bc66 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -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" diff --git a/docs/_docs/01-quick-start-guide.md b/docs/_docs/01-quick-start-guide.md index acd1a6b6..24351f74 100644 --- a/docs/_docs/01-quick-start-guide.md +++ b/docs/_docs/01-quick-start-guide.md @@ -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. diff --git a/docs/_docs/04-upgrading.md b/docs/_docs/04-upgrading.md index 5d710b00..f2c44df4 100644 --- a/docs/_docs/04-upgrading.md +++ b/docs/_docs/04-upgrading.md @@ -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: -``` - +```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). diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 3492737a..bb012367 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -2,12 +2,7 @@ --- - +{% include "copyright.html" %} {% include head.html %} diff --git a/minimal-mistakes-jekyll.gemspec b/minimal-mistakes-jekyll.gemspec index e985e498..e6f14e84 100644 --- a/minimal-mistakes-jekyll.gemspec +++ b/minimal-mistakes-jekyll.gemspec @@ -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" diff --git a/package.json b/package.json index 653e05b4..ef2399a5 100644 --- a/package.json +++ b/package.json @@ -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",