Copie les fichiers CSS du theme
This commit is contained in:
25
blog/blog.py
25
blog/blog.py
@@ -1,7 +1,9 @@
|
|||||||
import glob
|
import glob
|
||||||
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from blog.page import Page
|
from blog.page import Page
|
||||||
from blog.config import Config
|
from blog.config import Config
|
||||||
|
from blog.theme import Theme
|
||||||
from jinja2 import Environment, FileSystemLoader, Template
|
from jinja2 import Environment, FileSystemLoader, Template
|
||||||
|
|
||||||
|
|
||||||
@@ -32,6 +34,7 @@ class Blog:
|
|||||||
|
|
||||||
self._build_all_pages(page_template)
|
self._build_all_pages(page_template)
|
||||||
self._build_index(index_template)
|
self._build_index(index_template)
|
||||||
|
self._copy_css()
|
||||||
|
|
||||||
def _build_all_pages(self, template: Template):
|
def _build_all_pages(self, template: Template):
|
||||||
"""Convertit les pages markdown dans conf.inbox en html dans conf.outbox"""
|
"""Convertit les pages markdown dans conf.inbox en html dans conf.outbox"""
|
||||||
@@ -53,7 +56,21 @@ class Blog:
|
|||||||
with open(f"{self.conf.outbox}/index.html", "w+") as html_file:
|
with open(f"{self.conf.outbox}/index.html", "w+") as html_file:
|
||||||
html_file.write(html_content)
|
html_file.write(html_content)
|
||||||
|
|
||||||
# def _copycss_files(src_dir: str, dest_dir: str) -> list:
|
def _copy_css(self):
|
||||||
# list_css = glob.glob(f'{src_dir}/css/*.css')
|
css_path = Path(self.conf.theme) / 'css'
|
||||||
# for css_file in list_css:
|
dest_path = Path(self.conf.outbox) / 'css'
|
||||||
# shutil.copy(css_file, dest_dir)
|
|
||||||
|
if not dest_path.exists():
|
||||||
|
dest_path.mkdir()
|
||||||
|
|
||||||
|
for css_file in css_path.glob('*.css'):
|
||||||
|
dest_file = dest_path / css_file.name
|
||||||
|
|
||||||
|
shutil.copy(css_file, dest_file)
|
||||||
|
|
||||||
|
# dest = Path(str(dest_path) + '/' + Path(css_file).stem() + '.css')
|
||||||
|
|
||||||
|
# dest.write_text(Path(css_file).read_text)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user