kitian616 / jekyll-TeXt-theme

💎 🐳 A super customizable Jekyll theme for personal site, team site, blog, project, documentation, etc.
https://kitian616.github.io/jekyll-TeXt-theme/
MIT License
3.15k stars 2.55k forks source link

Duplicate highlight CSS #118

Open Krinkle opened 5 years ago

Krinkle commented 5 years ago

The highlight CSS is loaded twice in the browser output. This is less efficient but also makes it difficult to make a custom highlight theme because the default one is also applied first.

This means that if I omit styles for some of the Rouge Token types, instead of falling back to foreground text color, it falls back to the unrelated color from highlight/tomorrow.

I use this theme as a gem, and have a custom highlight file in _sass/skins/highlight/example.scss,

Steps to reproduce

  1. Use the TeXt theme via Gemfile.
  2. Create _sass/skins/highlight/example.scss.
  3. In _config.yml, set highlight_theme: example.

Expected behaviour

The example is loaded instead of one of the tomorrow highlight themes.

Actual behaviour

The example is loaded on top of the default tomorrow highlight theme associated with the text_skin.

Environment

kitian616 commented 5 years ago

Oh, I didn't think about this. I use @import to import a suitable highlight color for the skin, such as tomorrow-night for dark skin. Perhaps this is unnecessary.

Krinkle commented 5 years ago

@kitian616 I think a special default for each text skin is very good. I thought this is not working, so I can remove it.

But, I was wrong. It does work because default is empty, so it gets the special default (e.g. tomorrow-night for dark skin), and then the duplicate one is just "empty" (default).

There is only a problem for my use case when changing the setting to something that is not the default.

Maybe, we can solve this problem via variables.yaml key? We could have skin_highlight_theme_default that associates from :text_skin to :highlight_theme. Then, we would use that variable in main.scss as a magic default?

If you like this idea, I can implement it :)

kitian616 commented 5 years ago

great! I think this is the best solution so far :)