Skip to content

Commit

Permalink
Merge pull request #696 from SignalK/run_script_fix_css
Browse files Browse the repository at this point in the history
Compile css files automatically as part of "run build-frontend"
  • Loading branch information
mairas authored May 5, 2024
2 parents c184a19 + 662788e commit e195a0b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
9 changes: 3 additions & 6 deletions extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@

Import("env")

# install brotli if it isn't installed
#try:
# try:
# import brotli
#except ImportError:
# except ImportError:
# env.Execute("$PYTHONEXE -m pip install brotli")



def convert_files(root_file_path: pathlib.Path, target):
scripts.convert_html.convert_files(root_file_path, target)


def build_web_ui(*args, **kwargs) -> None:
# install and build the web UI
env.Execute("cd web && npm install && npm run build")

scripts.convert_html.convert_files(
pathlib.Path("web/dist/index.html"),
"src/sensesp/net/web/autogen/web_ui_files.h",
"kWebUIFiles",
"/"
"/",
)


Expand Down
20 changes: 11 additions & 9 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ function all {
checks
}

function install_pio {
function install-pio {
echo "📦 Installing PlatformIO project"
pio project init
}

function install_frontend {
function install-frontend {
echo "📦 Installing frontend dependencies"
( cd web && npm install )
}

function install {
echo "📦 Installing project and dependencies"
install_pio
install_frontend
install-pio
install-frontend
}

function clean {
Expand All @@ -57,20 +57,22 @@ function clean {
rm -rf web/node_modules/
}

function build_pio {
function build-pio {
echo "🏗️ Building the PlatformIO project"
pio run
}

function build_frontend {
function build-frontend {
echo "🏗️ Building the frontend"
( cd web && npm run css-compile )
( cd web && npm run build )
pio run -t webUI
}

function build {
echo "🏗️ Building the project"
build_frontend
build_pio
build-frontend
build-pio
}

function upload {
Expand All @@ -79,7 +81,7 @@ function upload {
pio run -t upload
}

function upload_monitor {
function upload-monitor {
echo "🚀 🖥️ Uploading the project and opening the serial monitor"
build
pio run -t upload --target monitor
Expand Down

0 comments on commit e195a0b

Please sign in to comment.