Build.json and custom CSS

As convention, put all the css in public/css and mention it in build.json which must be located here: ~/frappe_bench/apps/your_app/your_app/public/build.json, so it will be built with command bench build. If the build.json doesn’t exist, you can create one.

build.json. This will build css/custom_app.min.css from list of files.

{
	"css/custom_app.min.css": [
		"public/css/custom_app.css"
	]
}

e.g. apps/custom_app/custom_app/public/css/custom_app.css

div {
	color: #6c7680 !important;
	font-weight: bolder !important;
}

mention list of files to be loaded as css here
hooks.py

# for desk css
app_include_css = ["/assets/css/custom_app.min.css"]
# for web css
web_include_css = ["/assets/css/custom_app.min.css"]

if you wish to load file provided by third party without building it in build.json here is an example
keep file in public/js and mention it in hooks directly

19 Likes