use CSS::Minifier::XS qw//;
use JavaScript::Minifier::XS qw//;
+use Digest::SHA qw/sha256_base64/;
use IO::Compress::Gzip qw/gzip/;
-use File::Slurp qw/read_file write_file/;
+use File::Slurp qw/read_file write_file edit_file_lines/;
mkdir 'static';
mkdir 'static/css';
last
}
}
+
+edit_file_lines {
+ my ($file) = m,(static.*\.(?:css|js)),;
+ return unless $file;
+ my $hash = sha256_base64 scalar read_file $file;
+ s/integrity=".*"/integrity="sha256-$hash="/;
+} 'tmpl/skel.en'
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<link href="/static/css/cyborg.css" title="cyborg" rel="stylesheet">
-<link href="/static/css/slate.css" title="slate" rel="alternate stylesheet">
-<link href="/static/css/readable.css" title="readable" rel="alternate stylesheet">
-<script src="/static/js.js" type="text/javascript" async defer></script>
+<link href="/static/css/cyborg.css" title="cyborg" rel="stylesheet" integrity="x">
+<link href="/static/css/slate.css" title="slate" rel="alternate stylesheet" integrity="x">
+<link href="/static/css/readable.css" title="readable" rel="alternate stylesheet" integrity="x">
+<script src="/static/js.js" type="text/javascript" async defer integrity="x"></script>
<body>
<div class="container-fluid">