Compare commits

...

3 commits

10 changed files with 2519 additions and 2 deletions

4
.gitignore vendored
View file

@ -1,3 +1,7 @@
*~
*.pyc
dist/
docs/_build/
src/wuttafarm/web/static/css/wuttafarm-buefy.css
style/dist/
style/node_modules/

View file

@ -5,6 +5,12 @@ All notable changes to WuttaFarm will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## v0.1.4 (2026-02-07)
### Fix
- add custom style to better match farmOS color scheme
## v0.1.3 (2026-02-06)
### Fix

View file

@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "WuttaFarm"
version = "0.1.3"
version = "0.1.4"
description = "Web app to integrate with and extend farmOS"
readme = "README.md"
authors = [
@ -31,7 +31,7 @@ license = {text = "GNU General Public License v3"}
dependencies = [
"farmOS",
"psycopg2",
"WuttaWeb[continuum]>=0.27.2",
"WuttaWeb[continuum]>=0.27.3",
]
@ -62,3 +62,12 @@ update_changelog_on_bump = true
[tool.hatch.build.targets.wheel]
packages = ["src/wuttafarm"]
[tool.hatch.build.targets.sdist]
exclude = [
"style/node_modules/",
]
[tool.hatch.build.targets.sdist.force-include]
# nb. this is necessary due to git ignoring this file (iiuc)
"src/wuttafarm/web/static/css/wuttafarm-buefy.css" = "src/wuttafarm/web/static/css/wuttafarm-buefy.css"

View file

@ -23,6 +23,8 @@
WuttaFarm web app
"""
import os
from wuttaweb import app as base
@ -43,6 +45,15 @@ def main(global_config, **settings):
wutta_config = base.make_wutta_config(settings)
pyramid_config = base.make_pyramid_config(settings)
# custom buefy css
app = wutta_config.get_app()
path = app.resource_path("wuttafarm.web.static:css/wuttafarm-buefy.css")
if os.path.exists(path):
# TODO: this is not robust enough, probably..but works for me/now
wutta_config.setdefault(
"wuttaweb.liburl.buefy_css", "/wuttafarm/css/wuttafarm-buefy.css"
)
# bring in the rest of WuttaFarm
pyramid_config.include("wuttafarm.web.static")
pyramid_config.include("wuttafarm.web.subscribers")

2358
style/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

14
style/package.json Normal file
View file

@ -0,0 +1,14 @@
{
"main": "webpack.config.js",
"scripts": {
"build": "webpack --mode production"
},
"devDependencies": {
"buefy": "^0.9.29",
"css-loader": "^7.1.3",
"mini-css-extract-plugin": "^2.10.0",
"sass": "^1.97.3",
"sass-loader": "^16.0.7",
"webpack-cli": "^6.0.1"
}
}

1
style/src/index.js Normal file
View file

@ -0,0 +1 @@
require("./wuttafarm-buefy.scss");

View file

@ -0,0 +1,85 @@
// cf. https://v2.buefy.org/documentation/customization
// Import Bulma's core
@import "~bulma/sass/utilities/_all";
// Set your colors
// nb. primary color was stolen from gin theme in farmOS
$primary: rgb(0, 135, 95);
$primary-light: findLightColor($primary);
$primary-dark: findDarkColor($primary);
$primary-invert: findColorInvert($primary);
$twitter: #4099FF;
$twitter-invert: findColorInvert($twitter);
// Lists and maps
$custom-colors: null !default;
$custom-shades: null !default;
// Setup $colors to use as bulma classes (e.g. 'is-twitter')
$colors: mergeColorMaps(
(
"white": (
$white,
$black,
),
"black": (
$black,
$white,
),
"light": (
$light,
$light-invert,
),
"dark": (
$dark,
$dark-invert,
),
"primary": (
$primary,
$primary-invert,
$primary-light,
$primary-dark,
),
"link": (
$link,
$link-invert,
$link-light,
$link-dark,
),
"info": (
$info,
$info-invert,
$info-light,
$info-dark,
),
"success": (
$success,
$success-invert,
$success-light,
$success-dark,
),
"warning": (
$warning,
$warning-invert,
$warning-light,
$warning-dark,
),
"danger": (
$danger,
$danger-invert,
$danger-light,
$danger-dark,
),
),
$custom-colors
);
// Links
$link: $primary;
$link-invert: $primary-invert;
$link-focus-border: $primary;
// Import Bulma and Buefy styles
@import "~bulma";
@import "~buefy/src/scss/buefy";

13
style/webpack.config.js Normal file
View file

@ -0,0 +1,13 @@
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
plugins: [new MiniCssExtractPlugin({
filename: "css/wuttafarm-buefy.css",
})],
module: {
rules: [{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
}]
},
};

View file

@ -22,5 +22,21 @@ def release(c, skip_tests=False):
if os.path.exists("dist"):
shutil.rmtree("dist")
# custom styles for buefy
update_style(c)
c.run("python -m build --sdist")
c.run("twine upload dist/*")
@task
def update_style(c):
"""
Build/update the `wuttafarm-buefy.css` file
"""
os.chdir("style")
# c.run("nvm use lts/krypton")
c.run("npm install")
c.run("npm run build")
os.chdir(os.pardir)
shutil.copy("style/dist/css/wuttafarm-buefy.css", "src/wuttafarm/web/static/css/")