mirror of
https://github.com/leoncvlt/loconotion.git
synced 2024-08-30 18:12:12 +00:00
Changed --clean-style into --clean-css, added --clean-js
This commit is contained in:
parent
7c0dfbc9b6
commit
fce23497e9
@ -40,9 +40,14 @@ def main():
|
|||||||
help="Delete all previously cached files for the site before generating it",
|
help="Delete all previously cached files for the site before generating it",
|
||||||
)
|
)
|
||||||
argparser.add_argument(
|
argparser.add_argument(
|
||||||
"--clean-style",
|
"--clean-css",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Delete only previously cached .css files for the site before generating it",
|
help="Delete previously cached .css files for the site before generating it",
|
||||||
|
)
|
||||||
|
argparser.add_argument(
|
||||||
|
"--clean-js",
|
||||||
|
action="store_true",
|
||||||
|
help="Delete previously cached .js files for the site before generating it",
|
||||||
)
|
)
|
||||||
argparser.add_argument(
|
argparser.add_argument(
|
||||||
"--non-headless",
|
"--non-headless",
|
||||||
|
@ -58,16 +58,24 @@ class Parser:
|
|||||||
if self.args.get("clean", False):
|
if self.args.get("clean", False):
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(self.dist_folder)
|
shutil.rmtree(self.dist_folder)
|
||||||
log.info(f"Removing previously cached files in '{self.dist_folder}'")
|
log.info(f"Removing cached files in '{self.dist_folder}'")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
log.error(f"Cannot remove '{self.dist_folder}': {e}")
|
log.error(f"Cannot remove '{self.dist_folder}': {e}")
|
||||||
elif self.args.get("clean_style", False):
|
else:
|
||||||
|
if self.args.get("clean_css", False):
|
||||||
try:
|
try:
|
||||||
log.info(f"Removing previously cached style files in '{self.dist_folder}'")
|
log.info(f"Removing cached .css files in '{self.dist_folder}'")
|
||||||
for style_file in glob.glob(str(self.dist_folder / "*.css")):
|
for style_file in glob.glob(str(self.dist_folder / "*.css")):
|
||||||
os.remove(style_file)
|
os.remove(style_file)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
log.error(f"Cannot remove syle files in '{self.dist_folder}': {e}")
|
log.error(f"Cannot remove .css files in '{self.dist_folder}': {e}")
|
||||||
|
if self.args.get("clean_js", False):
|
||||||
|
try:
|
||||||
|
log.info(f"Removing cached .js files in '{self.dist_folder}'")
|
||||||
|
for style_file in glob.glob(str(self.dist_folder / "*.css")):
|
||||||
|
os.remove(style_file)
|
||||||
|
except OSError as e:
|
||||||
|
log.error(f"Cannot remove .js files in '{self.dist_folder}': {e}")
|
||||||
|
|
||||||
# create the output folder if necessary
|
# create the output folder if necessary
|
||||||
self.dist_folder.mkdir(parents=True, exist_ok=True)
|
self.dist_folder.mkdir(parents=True, exist_ok=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user