Compare commits
2 Commits
b5535b9b03
...
f826107e58
Author | SHA1 | Date |
---|---|---|
Darkn Neko | f826107e58 | |
Darkn Neko | 468c11ae20 |
|
@ -1,5 +1,2 @@
|
|||
dst/
|
||||
site/
|
||||
update
|
||||
swege
|
||||
.manifest
|
||||
|
|
4
Makefile
4
Makefile
|
@ -4,9 +4,9 @@ DESTINATION = dst
|
|||
PYHTON = python3
|
||||
PORT = 8000
|
||||
BIND = 127.0.0.1
|
||||
RS_USER = root
|
||||
RS_USER = neko
|
||||
RS_HOST = darkn.space
|
||||
RS_PATH = /var/www/html
|
||||
RS_PATH = /home/neko/cyancat_net
|
||||
CSSDIR = ${SOURCE}/assets/styles
|
||||
SCRIPTS_DIR = ./scripts
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env perl
|
||||
# Minifies CSS files, that is removes all whitespace characters.
|
||||
# Usage: `ls /path/to/css/files | /path/to/this/script`
|
||||
|
||||
use v5.14;
|
||||
use CSS::Packer;
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
# It leaves the copyright in place if it encounters the word 'copyright', this
|
||||
# adds 'license' word as a trigger.
|
||||
#
|
||||
# I have already sent a pull request for that: https://github.com/leejo/css-packer-perl/pull/12.
|
||||
$CSS::Packer::COPYRIGHT_COMMENT = '\/\*((?>[^*]|\*[^/])*(?:license|copyright)(?>[^*]|\*[^/])*)\*\/';
|
||||
|
||||
# There is no matching cleanup function to call afterwards.
|
||||
my $packer = CSS::Packer->init();
|
||||
|
||||
my $fh;
|
||||
my $mincss_path;
|
||||
my $content;
|
||||
my $min;
|
||||
|
||||
while (my $css_path = <>) {
|
||||
chomp $css_path;
|
||||
$mincss_path = $css_path =~ s/.css$/.min.css/r;
|
||||
|
||||
# Read CSS file.
|
||||
open($fh, '<', $css_path) or die "Cannot open $css_path: $!";
|
||||
$content = do { local $/; <$fh> };
|
||||
close $fh;
|
||||
|
||||
# Minify CSS.
|
||||
$min = $packer->minify(\$content, {compress => 'minify'});
|
||||
|
||||
# Write minified CSS down.
|
||||
open($fh, '>', $mincss_path) or die "Cannot open $mincss_path: $!";
|
||||
print $fh $min;
|
||||
close $fh;
|
||||
|
||||
say "$css_path -> $mincss_path";
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
# Creates a new website post, appends its link to the index.
|
||||
|
||||
use v5.14;
|
||||
use autodie;
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use Tie::File;
|
||||
use Time::Piece;
|
||||
|
||||
# '/' is both prepended, and appended.
|
||||
my $post_url_dir = 'posts';
|
||||
my $posts_dir = "./src/$post_url_dir";
|
||||
my $index_file = './src/index.md';
|
||||
|
||||
my $post_title;
|
||||
my $post_filename;
|
||||
|
||||
print "Post title: ";
|
||||
$post_title = <>;
|
||||
|
||||
print "Post file name, without extension: ";
|
||||
$post_filename = <>;
|
||||
|
||||
chomp $post_title;
|
||||
chomp $post_filename;
|
||||
|
||||
die "File already exists" if -e "$posts_dir/$post_filename.md";
|
||||
|
||||
# Create a post file and insert the title.
|
||||
open (my $fh, '>', "$posts_dir/$post_filename.md");
|
||||
say $fh "# $post_title";
|
||||
close $fh;
|
||||
|
||||
# Append a post URL to the index.
|
||||
tie my @index_lines, 'Tie::File', $index_file;
|
||||
my $posts_found = 0;
|
||||
for (@index_lines) {
|
||||
if ($posts_found) {
|
||||
$_ .= "\n* [$post_title](/$post_url_dir/$post_filename.html)";
|
||||
last;
|
||||
}
|
||||
$posts_found = 1 if ($_ =~ /and such:/i);
|
||||
}
|
||||
untie @index_lines;
|
||||
|
||||
my @cmd = ($ENV{EDITOR}, "$posts_dir/$post_filename.md");
|
||||
system @cmd;
|
|
@ -1,9 +1,6 @@
|
|||
<hr>
|
||||
<p class="f7">
|
||||
© 2022
|
||||
<a href="/">Darkn Neko</a> —
|
||||
<a href="https://creativecommons.org/licenses/by/4.0/">CC-BY 4.0 License</a></br>
|
||||
Built with <a href="https://github.com/sakhmatd/swege">swege and some catgirls</a></br>
|
||||
</p>
|
||||
<div>
|
||||
<a href="https://sakhmatd.ee/software/swege.html"><img src="/assets/badges/swege.gif" alt="Created with swege" title="Created with swege"></a>
|
||||
<a href="https://darkn.space"><img src="/assets/badges/hosted_ds.gif" alt="Hosted by Darkn.Space" title="Hosted by Darkn.Space"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 592 B |
Reference in New Issue