diff --git a/frappe/email/email_body.py b/frappe/email/email_body.py index 3dcdf00a8e..e36cd2e651 100755 --- a/frappe/email/email_body.py +++ b/frappe/email/email_body.py @@ -292,17 +292,9 @@ def inline_style_in_html(html): ''' from premailer import Premailer - apps = frappe.get_installed_apps() - - # add frappe email css file - css_files = ['assets/css/email.css'] - if 'frappe' in apps: - apps.remove('frappe') - - for app in apps: - path = 'assets/{0}/css/email.css'.format(app) - css_files.append(path) - + # get email css files from hooks + css_files = frappe.get_hooks('email_css') + css_files = [path.lstrip('/') for path in css_files] css_files = [css_file for css_file in css_files if os.path.exists(os.path.abspath(css_file))] p = Premailer(html=html, external_styles=css_files, strip_important=False) @@ -480,4 +472,4 @@ def sanitize_email_header(str): return str.replace('\r', '').replace('\n', '') def get_brand_logo(email_account): - return email_account.get('brand_logo') \ No newline at end of file + return email_account.get('brand_logo') diff --git a/frappe/hooks.py b/frappe/hooks.py index 967aed7f60..ba4176c3ed 100644 --- a/frappe/hooks.py +++ b/frappe/hooks.py @@ -52,6 +52,8 @@ web_include_js = [ web_include_css = [] +email_css = ['/assets/frappe/build/scss/email.css'] + website_route_rules = [ {"from_route": "/blog/", "to_route": "Blog Post"}, {"from_route": "/kb/", "to_route": "Help Article"},