diff --git a/.gitignore b/.gitignore index 7516173..dd5d25b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ public/css/uikit.css public/img/*.svg public/js/*.min.js public/css/*.css +public/webfonts diff --git a/gulpfile.js b/gulpfile.js index bd96a7c..cf4978e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,26 +4,25 @@ const minify = require('gulp-babel-minify'); const minifyCss = require('gulp-minify-css'); const less = require('gulp-less'); -// Copy libraries from node_moduels to public/js -gulp.task('copy-js', () => { - return gulp.src([ - 'node_modules/@fortawesome/fontawesome-free/js/fontawesome.min.js', - 'node_modules/@fortawesome/fontawesome-free/js/solid.min.js', - 'node_modules/uikit/dist/js/uikit.min.js', - 'node_modules/uikit/dist/js/uikit-icons.min.js' - ]) - .pipe(gulp.dest('public/js')); -}); - -// Copy UIKit SVG icons to public/img -gulp.task('copy-uikit-icons', () => { +gulp.task('copy-img', () => { return gulp.src('node_modules/uikit/src/images/backgrounds/*.svg') .pipe(gulp.dest('public/img')); }); +gulp.task('copy-font', () => { + return gulp.src('node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.*') + .pipe(gulp.dest('public/webfonts')); +}); + +// Copy files from node_modules +gulp.task('node-modules-copy', gulp.parallel('copy-img', 'copy-font')); + // Compile less gulp.task('less', () => { - return gulp.src('public/css/*.less') + return gulp.src([ + 'public/css/mango.less', + 'public/css/tags.less' + ]) .pipe(less()) .pipe(gulp.dest('public/css')); }); @@ -54,14 +53,19 @@ gulp.task('minify-css', () => { // Copy static files (includeing images) to dist gulp.task('copy-files', () => { - return gulp.src(['public/img/*', 'public/*.*', 'public/js/*.min.js'], { + return gulp.src([ + 'public/*.*', + 'public/img/*', + 'public/webfonts/*', + 'public/js/*.min.js' + ], { base: 'public' }) .pipe(gulp.dest('dist')); }); // Set up the public folder for development -gulp.task('dev', gulp.parallel('copy-js', 'copy-uikit-icons', 'less')); +gulp.task('dev', gulp.parallel('node-modules-copy', 'less')); // Set up the dist folder for deployment gulp.task('deploy', gulp.parallel('babel', 'minify-css', 'copy-files')); diff --git a/public/css/mango.less b/public/css/mango.less index 1ac84df..2b14d89 100644 --- a/public/css/mango.less +++ b/public/css/mango.less @@ -1,3 +1,10 @@ +// UIKit +@import "./uikit.less"; + +// FontAwesome +@import "../../node_modules/@fortawesome/fontawesome-free/less/fontawesome.less"; +@import "../../node_modules/@fortawesome/fontawesome-free/less/solid.less"; + // Item cards .item .uk-card { cursor: pointer; diff --git a/src/util/util.cr b/src/util/util.cr index d2e73c5..0e0d285 100644 --- a/src/util/util.cr +++ b/src/util/util.cr @@ -1,7 +1,7 @@ IMGS_PER_PAGE = 5 ENTRIES_IN_HOME_SECTIONS = 8 UPLOAD_URL_PREFIX = "/uploads" -STATIC_DIRS = ["/css", "/js", "/img", "/favicon.ico"] +STATIC_DIRS = %w(/css /js /img /webfonts /favicon.ico /robots.txt) SUPPORTED_FILE_EXTNAMES = [".zip", ".cbz", ".rar", ".cbr"] def random_str @@ -23,11 +23,21 @@ end def register_mime_types { + # Comic Archives ".zip" => "application/zip", ".rar" => "application/x-rar-compressed", ".cbz" => "application/vnd.comicbook+zip", ".cbr" => "application/vnd.comicbook-rar", + + # Favicon ".ico" => "image/x-icon", + + # FontAwesome fonts + ".woff" => "font/woff", + ".woff2" => "font/woff2", + ".eot" => "application/vnd.ms-fontobject", + ".ttf" => "font/ttf", + ".svg" => "image/svg+xml", }.each do |k, v| MIME.register k, v end diff --git a/src/views/components/head.html.ecr b/src/views/components/head.html.ecr index e804d40..2126ab5 100644 --- a/src/views/components/head.html.ecr +++ b/src/views/components/head.html.ecr @@ -4,13 +4,10 @@ Mango - <%= page.split("-").map(&.capitalize).join(" ") %> - - - diff --git a/src/views/components/uikit.html.ecr b/src/views/components/uikit.html.ecr new file mode 100644 index 0000000..619ece3 --- /dev/null +++ b/src/views/components/uikit.html.ecr @@ -0,0 +1,2 @@ + + diff --git a/src/views/download-manager.html.ecr b/src/views/download-manager.html.ecr index 920d4d1..552405a 100644 --- a/src/views/download-manager.html.ecr +++ b/src/views/download-manager.html.ecr @@ -25,14 +25,14 @@ diff --git a/src/views/layout.html.ecr b/src/views/layout.html.ecr index 82fa636..ff4853c 100644 --- a/src/views/layout.html.ecr +++ b/src/views/layout.html.ecr @@ -1,91 +1,89 @@ - <%= render_component "head" %> + <%= render_component "head" %> - -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- - +
-
- +
+
+
+
+
+
+ + +
+
+ +
+
-
-
-
-
-
-
-
- <%= content %> -
- +
-
-
- - - - - <%= yield_content "script" %> - +
+
+
+ <%= content %> +
+ +
+
+
+ + <%= render_component "uikit" %> + <%= yield_content "script" %> + diff --git a/src/views/login.html.ecr b/src/views/login.html.ecr index 3840a67..5175472 100644 --- a/src/views/login.html.ecr +++ b/src/views/login.html.ecr @@ -30,8 +30,7 @@ - - + <%= render_component "uikit" %> diff --git a/src/views/reader.html.ecr b/src/views/reader.html.ecr index 5db2f23..90cc78a 100644 --- a/src/views/reader.html.ecr +++ b/src/views/reader.html.ecr @@ -103,9 +103,8 @@ const eid = "<%= entry.id %>"; + <%= render_component "uikit" %> - -