Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add styles to emails

Anna Siwik183686964008
diff --git a/saleor/static/emails/js/emails.js b/saleor/static/emails/js/emails.js
new file mode 100644
index 0000000000..9bf9e44c7f
--- /dev/null
+++ b/saleor/static/emails/js/emails.js
@@ -0,0 +1 @@
+import '../scss/emails.scss';
diff --git a/saleor/static/emails/scss/components/_tables.scss b/saleor/static/emails/scss/components/_tables.scss
new file mode 100644
index 0000000000..e0809e7c62
--- /dev/null
+++ b/saleor/static/emails/scss/components/_tables.scss
@@ -0,0 +1,13 @@
+body {
+ background: #FFFFFF;
+ font-family: $font-family-sans-serif;
+ font-size: 13px;
+
+ .main-table {
+ margin: auto;
+ }
+
+ header .logo {
+ fill: black;
+ }
+}
diff --git a/saleor/static/emails/scss/components/_typography.scss b/saleor/static/emails/scss/components/_typography.scss
new file mode 100644
index 0000000000..053da55f6e
--- /dev/null
+++ b/saleor/static/emails/scss/components/_typography.scss
@@ -0,0 +1,7 @@
+@font-face {
+ font-family: 'Lato';
+ src: url('../../fonts/Lato-Regular.woff2') format('woff2'),
+ url('../../fonts/Lato-Regular.woff') format('woff'),
+ url('../../fonts/Lato-Regular.ttf') format('truetype');
+ font-weight: 400;
+}
diff --git a/saleor/static/emails/scss/emails.scss b/saleor/static/emails/scss/emails.scss
new file mode 100644
index 0000000000..5de275b481
--- /dev/null
+++ b/saleor/static/emails/scss/emails.scss
@@ -0,0 +1,5 @@
+@import "variables";
+
+@import "components/typography";
+
+@import "components/tables";
diff --git a/saleor/static/emails/scss/variables.scss b/saleor/static/emails/scss/variables.scss
new file mode 100644
index 0000000000..1eec7fcd16
--- /dev/null
+++ b/saleor/static/emails/scss/variables.scss
@@ -0,0 +1 @@
+$font-family-sans-serif: 'Lato', sans-serif;
diff --git a/templates/templated_email/html/base.html b/templates/templated_email/html/base.html
index b789a0e0d7..beedac4f87 100644
--- a/templates/templated_email/html/base.html
+++ b/templates/templated_email/html/base.html
@@ -6,9 +6,10 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
+ <link rel="stylesheet" href="{% static 'assets/emails.css' %}">
</head>
<body>
- <table>
+ <table class="main-table" align="center">
<tfoot>
<tr>
<td>
@@ -24,6 +25,7 @@
<td>
<header>
{% block header %}
+ <img class="logo" src='{% static 'images/logo.png' %}' alt="{% trans "Saleor" %}" width="200" />
{% endblock header %}
</header>
</td>
diff --git a/webpack.config.js b/webpack.config.js
index 396ef69bb0..8341c645f7 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -64,6 +64,7 @@ var config = {
dashboard: './saleor/static/dashboard/js/dashboard.js',
document: './saleor/static/dashboard/js/document.js',
storefront: './saleor/static/js/storefront.js',
+ emails: './saleor/static/emails/js/emails.js',
vendor: [
'babel-es6-polyfill',
'bootstrap',