Browse Source

Add different favicon to development environment (#2395)

Paweł Kuna 4 months ago
parent
commit
e96f055238

+ 5 - 0
.changeset/late-owls-press.md

@@ -0,0 +1,5 @@
+---
+"@tabler/core": patch
+---
+
+Add different favicon to development environment

BIN
docs/public/favicon-dev.ico


+ 1 - 0
preview/eleventy.config.mjs

@@ -22,6 +22,7 @@ export default function (eleventyConfig) {
 	eleventyConfig.addPassthroughCopy({
 		"node_modules/@tabler/core/dist": "dist",
 		"pages/favicon.ico": "favicon.ico",
+		"pages/favicon-dev.ico": "favicon-dev.ico",
 		"static": "static",
 	});
 

BIN
preview/pages/favicon-dev.ico


+ 5 - 2
shared/layouts/base.html

@@ -22,14 +22,17 @@
 		<meta name="HandheldFriendly" content="True"/>
 		<meta name="MobileOptimized" content="320"/>
 
-		<link rel="icon" href="{{ page | relative }}/favicon.ico" type="image/x-icon"/>
+		<link rel="icon" href="{{ page | relative }}/favicon.ico" type="image/x-icon" />
 		<link rel="shortcut icon" href="{{ page | relative }}/favicon.ico" type="image/x-icon"/>
-
 		<meta name="description" content="{{ description | default: site.description | escape }}"/>
 
 		{% include "layout/og.html" %}
+	{% elsif environment == 'development' %}
+		<link rel="icon" href="{{ page | relative }}/favicon-dev.ico" type="image/x-icon" />
+		<link rel="shortcut icon" href="{{ page | relative }}/favicon-dev.ico" type="image/x-icon" />
 	{% endif %}
 
+
 	{% include "layout/css.html" %}
 	{% include "layout/js-libs.html" head %}
 

+ 14 - 7
shared/layouts/docs/default.html

@@ -5,30 +5,32 @@
 	<meta charset="UTF-8">
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
 
+	{% if environment == 'preview' %}
+	
 	{% assign pageSection = "" %}
 	{% if page.url contains "/ui/" %}
-	  {% assign pageSection = "UI" %}
+	{% assign pageSection = "UI" %}
 	{% elsif page.url contains "/icons/" %}
-	  {% assign pageSection = "Icons" %}
+	{% assign pageSection = "Icons" %}
 	{% elsif page.url contains "/illustrations/" %}
-	  {% assign pageSection = "Illustrations" %}
+	{% assign pageSection = "Illustrations" %}
 	{% elsif page.url contains "/emails/" %}
-	  {% assign pageSection = "Emails" %}
+	{% assign pageSection = "Emails" %}
 	{% endif %}
 
 	{% assign metaTitle = title %}
 	{% if seoTitle %}
-	  {% assign metaTitle = seoTitle %}
+	{% assign metaTitle = seoTitle %}
 	{% endif %}
 
 	{% assign metaDescription = description %}
 	{% if seoDescription %}
-	  {% assign metaDescription = seoDescription %}
+	{% assign metaDescription = seoDescription %}
 	{% endif %}
 
 	{% assign siteName = "Tabler Documentation" %}
 	{% if pageSection != "" %}
-	  {% assign siteName = "Tabler " | append: pageSection | append: " Documentation" %}
+	{% assign siteName = "Tabler " | append: pageSection | append: " Documentation" %}
 	{% endif %}
 
 	<title>{{ metaTitle }} | {{ siteName }}</title>
@@ -48,6 +50,11 @@
 
 	<script defer data-api="/stats/event" data-domain="docs.tabler.io" src="/stats/js/script.js"></script>
 
+	{% elsif environment == 'development' %}
+	<link rel="icon" href="{{ page | relative }}/favicon-dev.ico" type="image/x-icon" />
+	<link rel="shortcut icon" href="{{ page | relative }}/favicon-dev.ico" type="image/x-icon" />
+	{% endif %}
+
 	<link rel="stylesheet" href="/dist/css/tabler{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" />
 	{% for plugin in site.cssPlugins %}
 	<link