emanote icon indicating copy to clipboard operation
emanote copied to clipboard

Live server and generated website use different tailwind colors

Open precompute opened this issue 3 years ago • 3 comments
trafficstars

Describe the bug

The live server and the generated website use different colors from tailwind.

reference: https://tailwindcss.com/docs/customizing-colors

color hash
server emerald #d1fae5
generated green #dcfce7
color hash
server amber #fffbeb
generated yellow #fefce8

Specifying "green" in the yaml file makes the live server use the color "emerald", but the generated website uses green.

Does not seem to affect the color blue for some reason.

It might affect more colors than green and yellow.

Example:

Using the docs/ folder in https://github.com/EmaApps/emanote/

Build the website, and run a live server with emanote run --port=8081

Open these two pages:

https://emanote.srid.ca/guide/yaml-config http://localhost:8081/guide/yaml-config

Desktop (please complete the following information):

  • Browser : Firefox, Brave

precompute avatar Nov 22 '22 10:11 precompute

Oh, I guess this is a discrepancy between tailwind versions. https://v2.tailwindcss.com/docs/customizing-colors says green=emerald and yellow=amber, but now these are different colors.

Specifying Emerald / Amber in the YAML breaks styling in the live server (no colors (white) or something else), but the generated website uses Emerald / Amber correctly.

precompute avatar Nov 22 '22 10:11 precompute

A hacky workaround for this is to add the following to templates/hooks/more-head.tpl:

<script src="https://cdn.tailwindcss.com"></script>

precompute avatar Nov 23 '22 16:11 precompute

Properly solving this (and #118) will require support for compiling Tailwind on the fly in live server of Ema: https://github.com/EmaApps/ema/issues/20

In the interim, perhaps we can allow disabling compiling Tailwind (so CDN is used) during static generation, e.g.: emanote gen --no-tailwind-compile .... Or it can be specified in index.yaml.

https://github.com/EmaApps/emanote/blob/3300092d40c9092e33a6b22e53a30a2a82796138/src/Emanote.hs#L87-L88

srid avatar Nov 23 '22 17:11 srid