module Clayoven::Toplevel::Util

Miscellanous utilities

Public Class Methods

lex_sort(files) click to toggle source

Sorts a list of filenames lexicographically, but for ‘index.clay’

# File lib/clayoven/util.rb, line 6
def self.lex_sort(files)
  (files.reject { |f| f == "index.clay" }).sort
end
ls_files() click to toggle source

Fetch all .clay files, ∞ directories deep

# File lib/clayoven/util.rb, line 11
def self.ls_files
  Dir.glob("**/*.clay").reject { |entry| File.directory? entry }
end
minify_design() click to toggle source

Minify css and js files, by shelling out to yarn

# File lib/clayoven/util.rb, line 16
def self.minify_design
  puts "[#{"YARN".green}]: Minifying js and css"
  fork { system "yarn minify" }
  Process.waitall
end
render_math(htmlfiles) click to toggle source

Shell out to yarn to render math, via MathJaX and XyJaX Very expensive if you have a lot of math on your site.

# File lib/clayoven/util.rb, line 24
def self.render_math(htmlfiles)
  fork { system "yarn jax #{htmlfiles}" }
  Process.waitall
end