From 3c41a6bbdf898d4f0cfc3f621c821cb9a6c55263 Mon Sep 17 00:00:00 2001 From: codecalm Date: Thu, 20 Oct 2022 23:54:47 +0200 Subject: [PATCH] `preview-dev` env --- gulpfile.js | 6 +++++- package.json | 1 + src/pages/_includes/layout/css.html | 8 ++++---- src/pages/_includes/layout/footer.html | 2 +- src/pages/_includes/layout/js.html | 8 ++++---- src/pages/_includes/layout/og.html | 6 +++--- src/pages/_layouts/base.html | 10 ++-------- src/pages/robots.txt | 2 +- src/pages/sitemap.xml | 6 +++--- 9 files changed, 24 insertions(+), 25 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index de2a07239..bf22f2a06 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -358,7 +358,11 @@ gulp.task('build-jekyll', (cb) => { var env = Object.create(process.env) if (argv.preview) { - env.JEKYLL_ENV = 'preview' + if (argv.dev) { + env.JEKYLL_ENV = 'preview-dev' + } else { + env.JEKYLL_ENV = 'preview' + } } else { env.JEKYLL_ENV = 'production' } diff --git a/package.json b/package.json index 99888a308..9b010ed49 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "start-plugins": "gulp start --with-plugins", "build": "gulp build", "preview": "gulp build --preview", + "preview-dev": "gulp build --preview --dev", "svg-optimize": "svgo -f svg/brand --pretty", "unused-files": "node build/unused-files.js", "release": "release-it", diff --git a/src/pages/_includes/layout/css.html b/src/pages/_includes/layout/css.html index 7e7d63c49..04e79cc26 100644 --- a/src/pages/_includes/layout/css.html +++ b/src/pages/_includes/layout/css.html @@ -9,16 +9,16 @@ {% for lib in site.data.libs.css %} {% if libs contains lib[0] %} {% for file in lib[1] %} - + {% endfor %} {% endif %} {% endfor %} {% endif %} - + {% for plugin in site.tabler-css-plugins %} - + {% endfor %} - \ No newline at end of file + \ No newline at end of file diff --git a/src/pages/_includes/layout/footer.html b/src/pages/_includes/layout/footer.html index eae237d44..a200b7b5a 100644 --- a/src/pages/_includes/layout/footer.html +++ b/src/pages/_includes/layout/footer.html @@ -22,7 +22,7 @@ All rights reserved.
  • - {% if jekyll.environment != 'development' %} + {% if jekyll.environment == 'preview' or jekyll.environment == 'production' %} v{{ site.data.package.version }} diff --git a/src/pages/_includes/layout/js.html b/src/pages/_includes/layout/js.html index 61d18827d..8c584b257 100644 --- a/src/pages/_includes/layout/js.html +++ b/src/pages/_includes/layout/js.html @@ -2,22 +2,22 @@ {% assign libs = page.libs | default: layout.libs %} {% assign google-maps-key = site.google-maps-dev-key %} -{% if jekyll.environment == 'preview' %} +{% if jekyll.environment != 'development' %} {% assign google-maps-key = site.google-maps-key %} {% endif %} {% for lib in site.data.libs.js %} {% if libs contains lib[0] or site.data.libs.global-libs contains lib[0] %} {% for file in lib[1] %} - + {% endfor %} {% endif %} {% endfor %} - - + + {% removeemptylines %} diff --git a/src/pages/_includes/layout/og.html b/src/pages/_includes/layout/og.html index b5aca6d5f..68bff8582 100644 --- a/src/pages/_includes/layout/og.html +++ b/src/pages/_includes/layout/og.html @@ -1,13 +1,13 @@ - + - + - + diff --git a/src/pages/_layouts/base.html b/src/pages/_layouts/base.html index 680fc2ab3..4d3837662 100644 --- a/src/pages/_layouts/base.html +++ b/src/pages/_layouts/base.html @@ -9,7 +9,7 @@ {% if title %}{{ title }} - {% endif %}{% if site.title %}{{ site.title }} - {% endif %}{{ site.description }} - {% if jekyll.environment == 'preview' %} + {% if jekyll.environment == 'preview' or jekyll.environment == 'preview-dev' %} {% include layout/analytics.html %} @@ -41,18 +41,12 @@ {% assign layout-dark = page.layout-dark | default: site.layout-dark %} - + {{ content }} {% include layout/modals-capture.html %} -{% comment %} - {% if jekyll.environment == 'preview' %} - {% include layout/sentry.html %} - {% endif %} -{% endcomment %} - {% include layout/js.html %} {% if site.debug and jekyll.environment == 'development' %} diff --git a/src/pages/robots.txt b/src/pages/robots.txt index d3d86b04a..5f636fbf1 100644 --- a/src/pages/robots.txt +++ b/src/pages/robots.txt @@ -1,4 +1,4 @@ --- layout: none --- -Sitemap: {% if jekyll.environment == 'preview' %}{{ site.preview-url }}{% endif %}{{ "sitemap.xml" | absolute_url }} +Sitemap: {% if jekyll.environment != 'development' %}{{ site.preview-url }}{% endif %}{{ "sitemap.xml" | absolute_url }} diff --git a/src/pages/sitemap.xml b/src/pages/sitemap.xml index c5dae7e4c..a9f8f29bb 100644 --- a/src/pages/sitemap.xml +++ b/src/pages/sitemap.xml @@ -8,7 +8,7 @@ layout: none {% assign docs = collection.docs | where_exp:'doc','doc.sitemap != false' %} {% for doc in docs %} - {% if jekyll.environment == 'preview' %}{{ site.preview-url }}{% endif %}{{ doc.url | replace: '/index.html', '/' | absolute_url | xml_escape }} + {% if jekyll.environment != 'development' %}{{ site.preview-url }}{% endif %}{{ doc.url | replace: '/index.html', '/' | absolute_url | xml_escape }} {% if doc.last_modified_at or doc.date %} {{ doc.last_modified_at | default: doc.date | date_to_xmlschema }} {% endif %} @@ -19,7 +19,7 @@ layout: none {% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' %} {% for page in pages %} - {% if jekyll.environment == 'preview' %}{{ site.preview-url }}{% endif %}{{ page.url | replace: '/index.html', '/' | absolute_url | xml_escape }} + {% if jekyll.environment != 'development' %}{{ site.preview-url }}{% endif %}{{ page.url | replace: '/index.html', '/' | absolute_url | xml_escape }} {{ page.last_modified_at | default: site.time | date_to_xmlschema }} {% endfor %} @@ -27,7 +27,7 @@ layout: none {% assign static_files = page.static_files | where_exp:'page','page.sitemap != false' | where_exp:'page','page.name != "404.html"' %} {% for file in static_files %} - {% if jekyll.environment == 'preview' %}{{ site.preview-url }}{% endif %}{{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }} + {% if jekyll.environment != 'development' %}{{ site.preview-url }}{% endif %}{{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }} {{ file.modified_time | date_to_xmlschema }} {% endfor %}