Add export avatar images task
11
Rakefile
@ -11,7 +11,7 @@ github_api_headers = {
|
|||||||
github_api_headers['Authorization'] = "Token #{ENV['GITHUB_API_BEARER_TOKEN']}" if ENV['GITHUB_API_BEARER_TOKEN']
|
github_api_headers['Authorization'] = "Token #{ENV['GITHUB_API_BEARER_TOKEN']}" if ENV['GITHUB_API_BEARER_TOKEN']
|
||||||
|
|
||||||
desc 'Build the site in Netlify with the given context'
|
desc 'Build the site in Netlify with the given context'
|
||||||
task :build, [:context, :base_url] do |_, args|
|
task :build, [:context, :base_url] => [:optimize_avatars] do |_, args|
|
||||||
args.with_defaults(context: 'production')
|
args.with_defaults(context: 'production')
|
||||||
draft_args = '--environment development --buildDrafts --buildFuture --buildExpired' unless args.context == 'production'
|
draft_args = '--environment development --buildDrafts --buildFuture --buildExpired' unless args.context == 'production'
|
||||||
base_uri_args = "-b #{args.base_url}" if args.base_url
|
base_uri_args = "-b #{args.base_url}" if args.base_url
|
||||||
@ -22,6 +22,15 @@ task :build, [:context, :base_url] do |_, args|
|
|||||||
sh "nix develop -c hugo #{draft_args} #{base_uri_args} --destination public"
|
sh "nix develop -c hugo #{draft_args} #{base_uri_args} --destination public"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'Export the avatar images'
|
||||||
|
task :export_avatars, [:base_dir, :output_dir, :output_extension] do |_, args|
|
||||||
|
args.with_defaults(base_dir: './assets/svg/', output_dir: './static/icons/', output_extension: 'webp')
|
||||||
|
Dir.glob('avatars/**/*.svg', base: args.base_dir) do |f|
|
||||||
|
output_file = "#{File.dirname(f)}/#{File.basename(f, '.svg')}.#{args.output_extension}"
|
||||||
|
sh "magick #{args.base_dir}#{f} -quality 10 #{args.output_dir}#{output_file}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc 'Build the webring to be embedded with the site'
|
desc 'Build the webring to be embedded with the site'
|
||||||
task :build_webring, [:limit, :input, :output, :file] do |_, args|
|
task :build_webring, [:limit, :input, :output, :file] do |_, args|
|
||||||
args.with_defaults(
|
args.with_defaults(
|
||||||
|
@ -32,6 +32,7 @@ mkShell {
|
|||||||
tree-sitter
|
tree-sitter
|
||||||
(tree-sitter.withPlugins (_: tree-sitter.allGrammars))
|
(tree-sitter.withPlugins (_: tree-sitter.allGrammars))
|
||||||
netlify-cli
|
netlify-cli
|
||||||
|
imagemagick
|
||||||
|
|
||||||
# Formatters...
|
# Formatters...
|
||||||
rufo # ...for Ruby.
|
rufo # ...for Ruby.
|
||||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 4.2 KiB |