Migrate npm run scripts to Rakefile tasks

Rakefile is like Makefile - it has dependency management,
while npm run scripts do not.

Aside from that, this also allows us to drop literally all Node.js packages,
as uglify-js is self-contained and has no dependencies.
Reduced node_modules from 17M to 374K.
This commit is contained in:
iBug committed 2024-05-05 04:03:07 +08:00
1 parent 6165d896a0
commit 0b8b5230f9
6 files changed
+39 -1783

No files matched your search

+1
View File
@@ -16,6 +16,7 @@
- Rewrite skin previews on `05-configuration.md` in Liquid template.
- Remove unused classes from `_layouts/single.html`.
- Migrate npm run scripts to Ruby Rake tasks.
## [4.25.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.25.1)
+31 -3
View File
@@ -3,10 +3,11 @@ require "jekyll"
require "json"
require "listen"
require "rake/clean"
require "shellwords"
require "time"
require "yaml"
task :default => [:copyright, :changelog]
task :default => [:copyright, :changelog, :js]
package_json = JSON.parse(File.read("package.json"))
@@ -73,8 +74,7 @@ task :preview do
puts " Halting auto-regeneration."
exit 0
end
loop { sleep 1000 }
sleep
end
rescue ThreadError
# You pressed Ctrl-C, oh my!
@@ -151,3 +151,31 @@ end
task :copyright => COPYRIGHT_FILES
CLEAN.include(*COPYRIGHT_FILES)
JS_FILES = Dir.glob("assets/js/plugins/*.js") + ["assets/js/_main.js"]
JS_TARGET = "assets/js/main.min.js"
task :js => JS_TARGET
file JS_TARGET => JS_FILES do |t|
sh Shellwords.join(%w[npx uglifyjs -c -m -o] + [t.name] + t.prerequisites)
sh "node banner.js"
end
task :watch_js do
listener = Listen.to(
"assets/js",
ignore: /main\.min\.js$/,
) do |modified, added, removed|
Rake::Task[:js].invoke
end
trap("INT") do
listener.stop
exit 0
end
begin
listener.start
sleep
rescue ThreadError
end
end
+1 -1
View File
@@ -4,4 +4,4 @@
* Free for personal and commercial use under the MIT license
* https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
*/
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(e.document)return t(e);throw new Error("jQuery requires a window with a document")}:t(e)}("undefined"!=typeof window?window:this,function(w,q){"use strict";function y(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item}function m(e){return null!=e&&e===e.window}var t=[],M=Object.getPrototypeOf,s=t.slice,_=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},$=t.push,R=t.indexOf,B={},F=B.toString,W=B.hasOwnProperty,z=W.toString,U=z.call(Object),g={},C=w.document,X={type:!0,src:!0,nonce:!0,noModule:!0};function Q(e,t,n){var r,o,i=(n=n||C).createElement("script");if(i.text=e,t)for(r in X)(o=t[r]||t.getAttribute&&t.getAttribute(r))&&i.setAttribute(r,o);n.head.appendChild(i).parentNode.removeChild(i)}function h(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?B[F.call(e)]||"object":typeof e}var e="3.6.0",T=function(e,t){return new T.fn.init(e,t)};function V(e){var t=!!e&&"length"in e&&e.length,n=h(e);return!y(e)&&!m(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}T.fn=T.prototype={jquery:e,constructor:T,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){e=T.merge(this.constructor(),e);return e.prevObject=this,e},each:function(e){return T.each(this,e)},map:function(n){return this.pushStack(T.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(T.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(T.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,e=+e+(e<0?t:0);return this.pushStack(0<=e&&e<t?[this[e]]:[])},end:function(){return this.prevObject||this.constructor()},push:$,sort:t.sort,splice:t.splice},T.extend=T.fn.extend=function(){var e,t,n,r,o,i=arguments[0]||{},a=1,s=arguments.length,l=!1;for("boolean"==typeof i&&(l=i,i=arguments[a]||{},a++),"object"==typeof i||y(i)||(i={}),a===s&&(i=this,a--);a<s;a++)if(null!=(e=arguments[a]))for(t in e)n=e[t],"__proto__"!==t&&i!==n&&(l&&n&&(T.isPlainObject(n)||(r=Array.isArray(n)))?(o=i[t],o=r&&!Array.isArray(o)?[]:r||T.isPlainObject(o)?o:{},r=!1,i[t]=T.extend(l,o,n)):void 0!==n&&(i[t]=n));return i},T.extend({expando:"jQuery"+(e+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){return!(!e||"[object Object]"!==F.call(e)||(e=M(e))&&("function"!=typeof(e=W.call(e,"constructor")&&e.constructor)||z.call(e)!==U))},isEmptyObject:function(e){for(var t in e)return!1;return!0},globalEval:function(e,t,n){Q(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(V(e))for(n=e.length;r<n&&!1!==t.call(e[r],r,e[r]);r++);else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){t=t||[];return null!=e&&(V(Object(e))?T.merge(t,"string"==typeof e?[e]:e):$.call(t,e)),t},inArray:function(e,t,n){return null==t?-1:R.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,o=e.length;r<n;r++)e[o++]=t[r];return e.length=o,e},grep:function(e,t,n){for(var r=[],o=0,i=e.length,a=!n;o<i;o++)!t(e[o],o)!=a&&r.push(e[o]);return r},map:function(e,t,n){var r,o,i=0,a=[];if(V(e))for(r=e.length;i<r;i++)null!=(o=t(e[i],i,n))&&a.push(o);else for(i in e)null!=(o=t(e[i],i,n))&&a.push(o);return _(a)},guid:1,support:g}),"function"==typeof Symbol&&(T.fn[Symbol.iterator]=t[Symbol.iterator]),T.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){B["[object "+t+"]"]=t.toLowerCase()});function r(e,t,n){for(var r=[],o=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&T(e).is(n))break;r.push(e)}return r}function Y(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}var e=function(q){function f(e,t){return e="0x"+e.slice(1)-65536,t||(e<0?String.fromCharCode(65536+e):String.fromCharCode(e>>10|55296,1023&e|56320))}function M(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}function _(){C()}var e,d,x,i,$,p,R,B,w,l,u,C,T,n,E,h,r,o,m,S="sizzle"+ +new Date,c=q.document,k=0,F=0,W=L(),z=L(),U=L(),g=L(),X=function(e,t){return e===t&&(u=!0),0},Q={}.hasOwnProperty,t=[],V=t.pop,Y=t.push,A=t.push,G=t.slice,y=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",a="[\\x20\\t\\r\\n\\f]",s="(?:\\\\[\\da-fA-F]{1,6}"+a+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",Z="\\["+a+"*("+s+")(?:"+a+"*([*^$|!~]?=)"+a+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+s+"))|)"+a+"*\\]",J=":("+s+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|Line truncated
!function(e,t){"function"==typeof define&&define.amd?define([],function(){return t(e)}):"object"==typeof exports?module.exports=t(e):e.Gumshoe=t(e)}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,function(d){"use strict";function u(e){e&&e.sort(function(e,t){return o(e.content)<o(t.content)?-1:1})}function n(){return d.innerHeight+d.pageYOffset>=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)}function p(e,t){var n;e&&(n=e.nav.closest("li"))&&(n.classList.remove(t.navClass),e.content.classList.remove(t.contentClass),i(n,t),m("gumshoeDeactivate",n,{link:e.nav,content:e.content,settings:t}))}var f={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},m=function(e,t,n){n.settings.events&&(e=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n}),t.dispatchEvent(e))},o=function(e){var t=0;if(e.offsetParent)for(;e;)t+=e.offsetTop,e=e.offsetParent;return 0<=t?t:0},g=function(e,t,n){e=e.getBoundingClientRect(),t="function"==typeof(t=t).offset?parseFloat(t.offset()):parseFloat(t.offset);return n?parseInt(e.bottom,10)<(d.innerHeight||document.documentElement.clientHeight):parseInt(e.top,10)<=t},h=function(e,t){return!(!n()||!g(e.content,t,!0))},i=function(e,t){t.nested&&(e=e.parentNode.closest("li"))&&(e.classList.remove(t.nestedClass),i(e,t))},v=function(e,t){t.nested&&(e=e.parentNode.closest("li"))&&(e.classList.add(t.nestedClass),v(e,t))};return function(e,t){function n(e){s&&d.cancelAnimationFrame(s),s=d.requestAnimationFrame(l.detect)}function o(e){s&&d.cancelAnimationFrame(s),s=d.requestAnimationFrame(function(){u(a),l.detect()})}var i,a,r,s,c,l={setup:function(){i=document.querySelectorAll(e),a=[],Array.prototype.forEach.call(i,function(e){var t=document.getElementById(decodeURIComponent(e.hash.substr(1)));t&&a.push({nav:e,content:t})}),u(a)}};l.detect=function(){var e,t,n,o=function(e,t){var n=e[e.length-1];if(h(n,t))return n;for(var o=e.length-1;0<=o;o--)if(g(e[o].content,t))return e[o]}(a,c);o?r&&o.content===r.content||(p(r,c),t=c,(e=o)&&(n=e.nav.closest("li"))&&(n.classList.add(t.navClass),e.content.classList.add(t.contentClass),v(n,t),m("gumshoeActivate",n,{link:e.nav,content:e.content,settings:t})),r=o):r&&(p(r,c),r=null)},l.destroy=function(){r&&p(r,c),d.removeEventListener("scroll",n,!1),c.reflow&&d.removeEventListener("resize",o,!1),c=s=r=i=a=null};return c=function(){var n={};return Array.prototype.forEach.call(arguments,function(e){for(var t in e){if(!e.hasOwnProperty(t))return;n[t]=e[t]}}),n}(f,t||{}),l.setup(),l.detect(),d.addEventListener("scroll",n,!1),c.reflow&&d.addEventListener("resize",o,!1),l}}),function(e,d){var o,t=e.jQuery||e.Cowboy||(e.Cowboy={});t.throttle=o=function(i,a,r,s){var c,l=0;function e(){var e=this,t=+new Date-l,n=arguments;function o(){l=+new Date,r.apply(e,n)}s&&!c&&o(),c&&clearTimeout(c),s===d&&i<t?o():!0!==a&&(c=setTimeout(s?function(){c=d}:o,s===d?i-t:i))}return"boolean"!=typeof a&&(s=r,r=a,a=d),t.guid&&(e.guid=r.guid=r.guid||t.guid++),e},t.debounce=function(e,t,n){return n===d?o(e,t,!1):o(e,n,!1!==t)}}(this),function(a){"use strict";a.fn.fitVids=function(e){var t,n,i={customSelector:null,ignore:null};return document.getElementById("fit-vids-style")||(t=document.head||document.getElementsByTagName("head")[0],(n=document.createElement("div")).innerHTML='<p>x</p><style id="fit-vids-style">.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>',t.appendChild(n.childNodes[1])),e&&a.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"],o=(i.customSelector&&e.push(i.customSelector),".fitvidsignore"),e=(i.ignore&&(o=o+", "+i.ignore),a(this).find(e.join(",")));(e=(e=e.not("object object")).not(o)).each(function(e){var t,n=a(this);0<n.parents(o).length||"embed"===this.tagName.toLowerCase()&&n.parent("object").length||n.parent(".fluid-width-video-wrapper").length||(n.css("height")||n.css("width")||!isNaN(n.attr("height"))&&!isNaN(n.attr("width"))||(n.attr("height",9),n.attr("width",16)),t=("object"===this.tagName.toLowerCase()||n.attr("height")&&!isNaN(parseInt(n.attr("height"),10))?parseInt(n.attr("height"),10):n.height())/(isNaN(parseInt(n.attr("width"),10))?n.width():parseInt(n.attr("width"),10)),n.attr("id")||n.attr("id","fitvid"+e),n.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*t+"%"),n.removeAttr("height").removeAttr("width"))})})}}(window.jQuery||window.Zepto),$(function(){var n,o,e,i,t=$("nav.greedy-nav .greedy-nav__toggle"),a=$("nav.greedy-nav .visiLine truncated
+2 -1
View File
@@ -5,7 +5,7 @@ permalink: "/docs/history/"
excerpt: Change log of enhancements and bug fixes made to the theme.
sidebar:
nav: docs
last_modified_at: '2024-05-05T03:17:32+08:00'
last_modified_at: '2024-05-05T04:00:39+08:00'
toc: false
---
@@ -31,6 +31,7 @@ toc: false
- Rewrite skin previews on `05-configuration.md` in Liquid template.
- Remove unused classes from `_layouts/single.html`.
- Migrate npm run scripts to Ruby Rake tasks.
## [4.25.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.25.1)
+3 -1769
View File
File diff suppressed because it is too large. Load diff
+1 -9
View File
@@ -22,14 +22,6 @@
"node": ">= 0.10.0"
},
"devDependencies": {
"npm-run-all": "^4.1.5",
"onchange": "^7.1.0",
"uglify-js": "^3.13.6"
},
"scripts": {
"uglify": "uglifyjs assets/js/vendor/jquery/jquery-3.6.0.js assets/js/plugins/jquery.fitvids.js assets/js/plugins/jquery.greedy-navigation.js assets/js/plugins/jquery.magnific-popup.js assets/js/plugins/jquery.ba-throttle-debounce.js assets/js/plugins/smooth-scroll.js assets/js/plugins/gumshoe.js assets/js/_main.js -c -m -o assets/js/main.min.js",
"add-banner": "node banner.js",
"watch:js": "onchange \"assets/js/**/*.js\" -e \"assets/js/main.min.js\" -- npm run build:js",
"build:js": "npm run uglify && npm run add-banner"
"uglify-js": "^3.17.4"
}
}