Skip to content

Commit

Permalink
Determine .lessc directory dynamically.
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbirchard committed Dec 27, 2023
1 parent 5dcb6ed commit 47577ec
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 64 deletions.
7 changes: 3 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ updates:
ignore:
- dependency-name: black
versions:
- 21.4b0
- 21.4b1
- 23.12.1
- dependency-name: faker
versions:
- 5.8.0
Expand Down Expand Up @@ -39,7 +38,7 @@ updates:
- 1.26.3
- dependency-name: pytest
versions:
- 6.2.2
- 7.4.3
- dependency-name: isort
versions:
- 5.7.0
- 5.13.2
19 changes: 12 additions & 7 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Class-based Flask app configuration."""
from os import environ, path, system
import subprocess
from os import environ, path

from dotenv import load_dotenv

Expand All @@ -25,13 +26,17 @@ class Config:

# Flask-Assets
if ENVIRONMENT == "development":
LESS_BIN = system("which lessc")
ASSETS_DEBUG = False
LESS_RUN_IN_DEBUG = False
# Check if `lessc` is installed
LESS_BIN = subprocess.call("which lessc", shell=True)
if LESS_BIN is None:
raise ValueError(
"Application running in `development` mode cannot create assets without `lessc` installed."
)
raise ValueError("Flask requires `lessc` to be installed to compile styles.")
else:
# Check if `nodejs` is installed
NODE_JS = subprocess.call("which node", shell=True)
if NODE_JS is None:
raise ValueError(
"Application running in `development` mode cannot create assets without `node` installed."
)

# Hardcoded data
PRODUCT_DATA_FILEPATH = f"{BASE_DIR}/data/products.json"
102 changes: 51 additions & 51 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==23.12.0 ; python_version >= "3.10" and python_version < "4.0"
black==23.12.1 ; python_version >= "3.10" and python_version < "4.0"
blinker==1.7.0 ; python_version >= "3.10" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.10" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
Expand All @@ -16,7 +16,7 @@ lesscpy==0.15.1 ; python_version >= "3.10" and python_version < "4.0"
markupsafe==2.1.3 ; python_version >= "3.10" and python_version < "4.0"
mccabe==0.7.0 ; python_version >= "3.10" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
mypy==1.7.1 ; python_version >= "3.10" and python_version < "4.0"
mypy==1.8.0 ; python_version >= "3.10" and python_version < "4.0"
packaging==23.2 ; python_version >= "3.10" and python_version < "4.0"
pathspec==0.12.1 ; python_version >= "3.10" and python_version < "4.0"
platformdirs==4.1.0 ; python_version >= "3.10" and python_version < "4.0"
Expand Down

0 comments on commit 47577ec

Please sign in to comment.