update statics

This commit is contained in:
Andros Fenollosa 2021-07-20 01:00:40 +02:00
parent fd6e9f07f9
commit f18e78db42
9 changed files with 27 additions and 23 deletions

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View File

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

@ -22,20 +22,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
<meta name="author" content="Tu nombre">
<meta name="generator" content="RSSPAPER">
<meta name="keywords" content="html, css, javascript">
<meta name="description" content="My news">
<meta property="og:image" content="img/screenshot.png">
<meta property="og:title" content="The Rock">
<meta property="og:type" content="website">
<meta property="og:url" content="">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@cuenta">
<meta name="twitter:creator" content="@cuenta">
<meta property="og:image:secure_url" content="https://...">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="300">
<meta property="og:image:alt" content="">
<!-- Normalize -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
<!-- End Normalize -->

View File

@ -1,26 +1,26 @@
{
"name": "RSSPaper",
"short_name": "RSSPaper",
"name": "RSSPAPER",
"short_name": "RSSPAPER",
"theme_color": "#ffffff",
"icons": [
{
"src": "./static/img/icons/android-chrome-192x192.png",
"src": "img/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "./static/img/icons/android-chrome-512x512.png",
"src": "img/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "./static/img/icons/android-chrome-maskable-192x192.png",
"src": "img/icons/android-chrome-maskable-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "./static/img/icons/android-chrome-maskable-512x512.png",
"src": "img/icons/android-chrome-maskable-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"

View File

@ -2,18 +2,32 @@
(:require
[clojure.java.io :as io]
[rsspaper.config :refer [config]]
[clojure.string :as str]
[selmer.parser :as s]))
(defn make-html
[articles]
;; Render html in dist/index.html
(let [dir "dist"
path (str dir "/index.html")]
(let [dir-dist "dist/"
path-theme (io/resource (str "themes/" (:theme config) "/"))
path-dist-index (str dir-dist "index.html")
]
;; Remove old index.html
(when (.exists (io/file path)) (io/delete-file path))
#_(when (.exists (io/file path-dist-index)) (io/delete-file path-dist-index))
;; Make dir dist
(.mkdir (java.io.File. dir))
#_(.mkdir (java.io.File. dir-dist))
;; Make dist/index.html
(with-open [wrtr (io/writer path)]
(.write wrtr (s/render-file (str "themes/" (:theme config) ".html") {:title (:title config)
:articles articles})))))
#_(with-open [wrtr (io/writer path-dist-index)]
(.write wrtr (s/render-file (str path-theme "index.html") {:title (:title config)
:articles articles})))
;; Make statics
;; Iterate statics
(doseq [file (.listFiles (io/file path-theme) )]
(let [path (.getPath file)
relative-path (second (str/split path #"resources/"))
relative-dist-path (str dir-dist relative-path)]
;; Remove old static
(when (.exists (io/file relative-dist-path)) (io/delete-file relative-dist-path))
;; Copy new static
(io/copy (io/file path) (io/file dir-dist))))))