mirror of
https://github.com/hacks-guide/minimal-mistakes.git
synced 2024-11-23 08:49:50 +00:00
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:
parent
6165d896a0
commit
0b8b5230f9
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
- Rewrite skin previews on `05-configuration.md` in Liquid template.
|
- Rewrite skin previews on `05-configuration.md` in Liquid template.
|
||||||
- Remove unused classes from `_layouts/single.html`.
|
- 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)
|
## [4.25.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.25.1)
|
||||||
|
|
||||||
|
34
Rakefile
34
Rakefile
@ -3,10 +3,11 @@ require "jekyll"
|
|||||||
require "json"
|
require "json"
|
||||||
require "listen"
|
require "listen"
|
||||||
require "rake/clean"
|
require "rake/clean"
|
||||||
|
require "shellwords"
|
||||||
require "time"
|
require "time"
|
||||||
require "yaml"
|
require "yaml"
|
||||||
|
|
||||||
task :default => [:copyright, :changelog]
|
task :default => [:copyright, :changelog, :js]
|
||||||
|
|
||||||
package_json = JSON.parse(File.read("package.json"))
|
package_json = JSON.parse(File.read("package.json"))
|
||||||
|
|
||||||
@ -73,8 +74,7 @@ task :preview do
|
|||||||
puts " Halting auto-regeneration."
|
puts " Halting auto-regeneration."
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
sleep
|
||||||
loop { sleep 1000 }
|
|
||||||
end
|
end
|
||||||
rescue ThreadError
|
rescue ThreadError
|
||||||
# You pressed Ctrl-C, oh my!
|
# You pressed Ctrl-C, oh my!
|
||||||
@ -151,3 +151,31 @@ end
|
|||||||
task :copyright => COPYRIGHT_FILES
|
task :copyright => COPYRIGHT_FILES
|
||||||
|
|
||||||
CLEAN.include(*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
|
||||||
|
2
assets/js/main.min.js
vendored
2
assets/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@ permalink: "/docs/history/"
|
|||||||
excerpt: Change log of enhancements and bug fixes made to the theme.
|
excerpt: Change log of enhancements and bug fixes made to the theme.
|
||||||
sidebar:
|
sidebar:
|
||||||
nav: docs
|
nav: docs
|
||||||
last_modified_at: '2024-05-05T03:17:32+08:00'
|
last_modified_at: '2024-05-05T04:00:39+08:00'
|
||||||
toc: false
|
toc: false
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ toc: false
|
|||||||
|
|
||||||
- Rewrite skin previews on `05-configuration.md` in Liquid template.
|
- Rewrite skin previews on `05-configuration.md` in Liquid template.
|
||||||
- Remove unused classes from `_layouts/single.html`.
|
- 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)
|
## [4.25.1](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.25.1)
|
||||||
|
|
||||||
|
1772
package-lock.json
generated
1772
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -22,14 +22,6 @@
|
|||||||
"node": ">= 0.10.0"
|
"node": ">= 0.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"npm-run-all": "^4.1.5",
|
"uglify-js": "^3.17.4"
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user