From 49e8a99e36a1926cd57620585ad3cf96584733b3 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 16 May 2019 20:32:14 +0100 Subject: [PATCH] Test adding a variable via preprocessing --- web/themes/contrib/tailwindcss/tailwindcss.theme | 7 +++++++ web/themes/contrib/tailwindcss/webpack.mix.js | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/themes/contrib/tailwindcss/tailwindcss.theme b/web/themes/contrib/tailwindcss/tailwindcss.theme index 2e9932e..9d6ee4f 100644 --- a/web/themes/contrib/tailwindcss/tailwindcss.theme +++ b/web/themes/contrib/tailwindcss/tailwindcss.theme @@ -5,6 +5,13 @@ * Functions to support theming in the Tailwind CSS theme. */ +/** + * Implements hook_preprocess_HOOK(). + */ +function tailwindcss_preprocess_html(&$variables) { + $variables['attributes']['class'][] = 'tw-bg-red-200'; +} + /** * Implements hook_preprocess_HOOK(). */ diff --git a/web/themes/contrib/tailwindcss/webpack.mix.js b/web/themes/contrib/tailwindcss/webpack.mix.js index 9d6834d..4870ad4 100644 --- a/web/themes/contrib/tailwindcss/webpack.mix.js +++ b/web/themes/contrib/tailwindcss/webpack.mix.js @@ -7,5 +7,6 @@ mix.postCss('src/main.css', 'dist', [ ]) .purgeCss({ folders: ['templates'], - extensions: ['html', 'twig'] + extensions: ['html', 'twig'], + whitelistPatterns: [/tw-bg-red-200/] })