Merge pull request #30 from spotlightishere/master
Clean up Jekyll base
This commit is contained in:
commit
63a1162fbc
5 changed files with 2 additions and 129 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,5 +12,5 @@ example/_site
|
|||
node_modules
|
||||
npm-debug.log*
|
||||
/vendor
|
||||
torrents
|
||||
/.idea
|
||||
Gemfile.lock
|
76
Rakefile
76
Rakefile
|
@ -1,76 +0,0 @@
|
|||
require "bundler/gem_tasks"
|
||||
require "jekyll"
|
||||
require "listen"
|
||||
|
||||
def listen_ignore_paths(base, options)
|
||||
[
|
||||
/_config\.ya?ml/,
|
||||
/_site/,
|
||||
/\.jekyll-metadata/
|
||||
]
|
||||
end
|
||||
|
||||
def listen_handler(base, options)
|
||||
site = Jekyll::Site.new(options)
|
||||
Jekyll::Command.process_site(site)
|
||||
proc do |modified, added, removed|
|
||||
t = Time.now
|
||||
c = modified + added + removed
|
||||
n = c.length
|
||||
relative_paths = c.map{ |p| Pathname.new(p).relative_path_from(base).to_s }
|
||||
print Jekyll.logger.message("Regenerating:", "#{relative_paths.join(", ")} changed... ")
|
||||
begin
|
||||
Jekyll::Command.process_site(site)
|
||||
puts "regenerated in #{Time.now - t} seconds."
|
||||
rescue => e
|
||||
puts "error:"
|
||||
Jekyll.logger.warn "Error:", e.message
|
||||
Jekyll.logger.warn "Error:", "Run jekyll build --trace for more information."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :preview do
|
||||
base = Pathname.new('.').expand_path
|
||||
options = {
|
||||
"source" => base.join('test').to_s,
|
||||
"destination" => base.join('test/_site').to_s,
|
||||
"force_polling" => false,
|
||||
"serving" => true,
|
||||
"theme" => "minimal-mistakes-jekyll"
|
||||
}
|
||||
|
||||
options = Jekyll.configuration(options)
|
||||
|
||||
ENV["LISTEN_GEM_DEBUGGING"] = "1"
|
||||
listener = Listen.to(
|
||||
base.join("_data"),
|
||||
base.join("_includes"),
|
||||
base.join("_layouts"),
|
||||
base.join("_sass"),
|
||||
base.join("assets"),
|
||||
options["source"],
|
||||
:ignore => listen_ignore_paths(base, options),
|
||||
:force_polling => options['force_polling'],
|
||||
&(listen_handler(base, options))
|
||||
)
|
||||
|
||||
begin
|
||||
listener.start
|
||||
Jekyll.logger.info "Auto-regeneration:", "enabled for '#{options["source"]}'"
|
||||
|
||||
unless options['serving']
|
||||
trap("INT") do
|
||||
listener.stop
|
||||
puts " Halting auto-regeneration."
|
||||
exit 0
|
||||
end
|
||||
|
||||
loop { sleep 1000 }
|
||||
end
|
||||
rescue ThreadError
|
||||
# You pressed Ctrl-C, oh my!
|
||||
end
|
||||
|
||||
Jekyll::Commands::Serve.process(options)
|
||||
end
|
|
@ -209,7 +209,7 @@ sass:
|
|||
style: compressed # http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style
|
||||
|
||||
# Plugins
|
||||
gems:
|
||||
plugins:
|
||||
- jekyll-paginate
|
||||
- jekyll-sitemap
|
||||
- jekyll-gist
|
||||
|
|
17
banner.js
17
banner.js
|
@ -1,17 +0,0 @@
|
|||
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 ${dateObj.getFullYear()} Michael Rose - mademistakes.com | @mmistakes
|
||||
* Licensed under ${pkg.license}
|
||||
*/
|
||||
`;
|
||||
|
||||
if (script.slice(0, 3) != '/**') {
|
||||
fs.writeFileSync(filename, banner + script);
|
||||
}
|
34
package.json
34
package.json
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "minimal-mistakes",
|
||||
"version": "4.6.0",
|
||||
"description": "Minimal Mistakes Jekyll theme npm build scripts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mmistakes/minimal-mistakes.git"
|
||||
},
|
||||
"keywords": [
|
||||
"jekyll",
|
||||
"theme",
|
||||
"minimal"
|
||||
],
|
||||
"author": "Michael Rose",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mmistakes/minimal-mistakes/issues"
|
||||
},
|
||||
"homepage": "https://mmistakes.github.io/minimal-mistakes/",
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"npm-run-all": "^1.7.0",
|
||||
"onchange": "^2.2.0",
|
||||
"uglify-js": "^2.6.1"
|
||||
},
|
||||
"scripts": {
|
||||
"uglify": "uglifyjs assets/js/vendor/jquery/jquery-3.2.1.min.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.smooth-scroll.min.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 a new issue