2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-23 07:08:39 +00:00

fix(frappe-nginx): Generate Standard Style CSS

use nunjucks to render jinja2 template
generate default theme
This commit is contained in:
Revant Nandgaonkar 2020-04-23 14:56:46 +05:30
parent 974f7dd74c
commit 4f411104f3
3 changed files with 36 additions and 2 deletions

View File

@ -6,13 +6,23 @@ RUN mkdir -p /home/frappe/frappe-bench/sites \
RUN install_packages git
RUN mkdir -p apps sites/assets \
RUN mkdir -p apps sites/assets/css \
&& cd apps \
&& git clone --depth 1 https://github.com/frappe/frappe
COPY build/frappe-nginx/generate_standard_style_css.js \
/home/frappe/frappe-bench/apps/frappe/generate_standard_style_css.js
RUN cd /home/frappe/frappe-bench/apps/frappe \
&& yarn \
&& yarn run production \
&& yarn add nunjucks -D \
&& node generate_standard_style_css.js \
frappe/website/doctype/website_theme/website_theme_template.scss > \
/home/frappe/standard_templates_string \
&& node generate_bootstrap_theme.js \
/home/frappe/frappe-bench/sites/assets/css/standard_style.css \
"$(cat /home/frappe/standard_templates_string)" \
&& rm -fr node_modules \
&& yarn install --production=true \
&& node --version \

View File

@ -0,0 +1,14 @@
const nunjucks = require("nunjucks");
const templatePath = process.argv[2];
const pathArray = templatePath.split("/");
const templateFile = pathArray.pop();
const templateDir = pathArray.join("/");
nunjucks.configure(templateDir);
const rendered = nunjucks.render(templateFile, {
button_rounded_corners: true,
font_properties: "300,600",
});
console.log(rendered.replace(/\n/gm, "\\n"));

View File

@ -6,13 +6,23 @@ RUN mkdir -p /home/frappe/frappe-bench/sites \
RUN install_packages git
RUN mkdir -p apps sites/assets \
RUN mkdir -p apps sites/assets/css \
&& cd apps \
&& git clone --depth 1 https://github.com/frappe/frappe --branch version-12
COPY build/frappe-nginx/generate_standard_style_css.js \
/home/frappe/frappe-bench/apps/frappe/generate_standard_style_css.js
RUN cd /home/frappe/frappe-bench/apps/frappe \
&& yarn \
&& yarn run production \
&& yarn add nunjucks -D \
&& node generate_standard_style_css.js \
frappe/website/doctype/website_theme/website_theme_template.scss > \
/home/frappe/standard_templates_string \
&& node generate_bootstrap_theme.js \
/home/frappe/frappe-bench/sites/assets/css/standard_style.css \
"$(cat /home/frappe/standard_templates_string)" \
&& rm -fr node_modules \
&& yarn install --production=true \
&& node --version \