MIN_PERL_VERSION => '5.14.0',
LICENSE => 'AGPL_3',
SIGN => 1,
+ clean => {
+ FILES => 'static/css/ static/js.js'
+ },
BUILD_REQUIRES => {
- qw/Test::MockTime 0
+ qw/CSS::Minifier::XS 0
+ File::Slurp 0
+ JavaScript::Minifier::XS 0
+ Test::MockTime 0
Test::More 0
Test::WWW::Mechanize::PSGI 0/,
},
strict 0
warnings 0
- CSS::Minifier::XS 0
Email::Simple 0
Email::Sender::Simple 0
File::Slurp 0
Gruntmaster::Data 0
HTML::Seamstress 0
- JavaScript::Minifier::XS 0
JSON::MaybeXS 0
Log::Log4perl 0
PerlX::Maybe 0
(function(){
'use strict';
function set_style(name){
- $('#stylesheet').attr("href", "/css/" + name + ".css");
+ $('#stylesheet').attr("href", "/static/css/" + name + ".css");
localStorage.setItem("theme", name);
}
use strict;
our $VERSION = '5999.000_001';
-use CSS::Minifier::XS;
use Encode qw/encode decode/;
use File::Slurp qw/read_file/;
-use JavaScript::Minifier::XS;
use JSON::MaybeXS qw/encode_json/;
use PerlX::Maybe;
use Scope::Upper qw/unwind SUB UP/;
use constant NOT_FOUND => [404, ['X-Forever' => 1, 'Content-Type' => 'text/plain'], ['Not found']];
-sub development() { ($ENV{PLACK_ENV} // 'development') eq 'development' }
-
my ($env, $privacy);
sub db { $env->{'gruntmaster.dbic'} }
$privacy = 'public';
sub (GET) {
- sub (/css/:theme) {
- my $theme = $_{theme};
- return NOT_FOUND unless -e "css/themes/$theme.css";
- my $css = read_file "css/themes/$theme.css";
- $css .= read_file $_ for <css/*.css>;
- my @headers = ('X-Forever' => 1, 'Cache-Control' => 'public, max-age=604800', 'Content-Type' => 'text/css; charset=utf-8');
- [200, \@headers, [development ? $css : CSS::Minifier::XS::minify $css]]
- },
-
- sub (/js.js) {
- my $js;
- $js .= read_file $_ for <js/*.js>;
- my @headers = ('X-Forever' => 1, 'Cache-Control' => 'public, max-age=604800', 'Content-Type' => 'application/javascript; charset=utf-8');
- [200, \@headers, [development ? $js : JavaScript::Minifier::XS::minify $js]]
- },
-
sub (/robots.txt) { NOT_FOUND },
sub (/src/:job) {
--- /dev/null
+#!/usr/bin/perl
+use v5.14;
+use warnings;
+
+use CSS::Minifier::XS qw//;
+use JavaScript::Minifier::XS qw//;
+
+use File::Slurp qw/read_file write_file/;
+
+mkdir 'static';
+mkdir 'static/css';
+
+my $common_css;
+$common_css .= read_file $_ for <css/*.css>;
+for (<css/themes/*>) {
+ my ($theme) = m,themes/(.*)\.css,;
+ my $css = read_file $_;
+ $css .= $common_css;
+ write_file "static/css/$theme.css", CSS::Minifier::XS::minify $css;
+}
+
+my $js;
+$js .= read_file $_ for <js/*.js>;
+write_file 'static/js.js', JavaScript::Minifier::XS::minify $js;
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
-<link rel="stylesheet" href="/css/cyborg.css" id="stylesheet">
-<script src="/js.js" type="text/javascript" async defer></script>
+<link rel="stylesheet" href="/static/css/cyborg.css" id="stylesheet">
+<script src="/static/js.js" type="text/javascript" async defer></script>
<body>
<nav role="navigation">