feat: hook for website_theme_scss
This commit is contained in:
parent
bc320acdab
commit
e7d21a813c
3 changed files with 11 additions and 3 deletions
|
|
@ -157,6 +157,9 @@ app_license = "{app_license}"
|
|||
# web_include_css = "/assets/{app_name}/css/{app_name}.css"
|
||||
# web_include_js = "/assets/{app_name}/js/{app_name}.js"
|
||||
|
||||
# include custom scss in every website theme (without file extension ".scss")
|
||||
# website_theme_scss = "{app_name}/public/scss/website"
|
||||
|
||||
# include js, css files in header of web form
|
||||
# webform_include_js = {{"doctype": "public/js/doctype.js"}}
|
||||
# webform_include_css = {{"doctype": "public/css/doctype.css"}}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class WebsiteTheme(Document):
|
|||
file_name = frappe.scrub(self.name) + '_' + suffix + '.css'
|
||||
output_path = join_path(folder_path, file_name)
|
||||
|
||||
content = get_scss(self)
|
||||
self.theme_scss = content = get_scss(self)
|
||||
content = content.replace('\n', '\\n')
|
||||
command = ['node', 'generate_bootstrap_theme.js', output_path, content]
|
||||
|
||||
|
|
@ -128,5 +128,6 @@ def get_active_theme():
|
|||
|
||||
|
||||
def get_scss(doc):
|
||||
return frappe.render_template('frappe/website/doctype/website_theme/website_theme_template.scss', doc.as_dict())
|
||||
|
||||
opts = doc.as_dict()
|
||||
opts['website_theme_scss'] = frappe.get_hooks('website_theme_scss')
|
||||
return frappe.render_template('frappe/website/doctype/website_theme/website_theme_template.scss', opts)
|
||||
|
|
|
|||
|
|
@ -26,3 +26,7 @@ body {
|
|||
|
||||
// Custom Theme
|
||||
{{ custom_scss or '' }}
|
||||
|
||||
{% for app_scss in website_theme_scss %}
|
||||
@import "{{ app_scss }}"
|
||||
{% endfor %}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue