From c64a7bd26fefb53aee53667cf33e2c72b7d07311 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sun, 31 Oct 2021 22:03:04 +0100 Subject: build: use php dotenv instead of js to inject style.js in dev mode --- index.php | 2 ++ legal-notice.php | 2 ++ license.php | 2 ++ mentions-legales.php | 2 ++ src/js/app.js | 15 +-------------- src/js/utilities/helpers.js | 13 ++----------- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/index.php b/index.php index d0b2f7c..35f317d 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,8 @@ $dap_current_env = dap_get_current_env(); '; + } else { + echo ''; } ?> diff --git a/legal-notice.php b/legal-notice.php index 67a1ade..1d8c350 100644 --- a/legal-notice.php +++ b/legal-notice.php @@ -14,6 +14,8 @@ $dap_current_env = dap_get_current_env(); '; + } else { + echo ''; } ?> diff --git a/license.php b/license.php index 402c696..5470c63 100644 --- a/license.php +++ b/license.php @@ -14,6 +14,8 @@ $dap_current_env = dap_get_current_env(); '; + } else { + echo ''; } ?> diff --git a/mentions-legales.php b/mentions-legales.php index e42f363..c68c415 100644 --- a/mentions-legales.php +++ b/mentions-legales.php @@ -14,6 +14,8 @@ $dap_current_env = dap_get_current_env(); '; + } else { + echo ''; } ?> diff --git a/src/js/app.js b/src/js/app.js index 38aee0e..8e23ca9 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -11,7 +11,7 @@ import { showFromBottom, showFromLeft, } from './utilities/animations'; -import { isSmallVw, isStyleJsExists } from './utilities/helpers'; +import { isSmallVw } from './utilities/helpers'; /** * Show/hide header and footer with slide animation (left). @@ -303,18 +303,6 @@ function printProjectsNav() { }); } -/** - * Add style.js script for development purposes. - */ -function loadWebpackStyles() { - if (isStyleJsExists()) { - const head = document.querySelector('head'); - const script = document.createElement('script'); - script.src = 'assets/js/style.js'; - head.appendChild(script); - } -} - /** * Load corresponding project if the requested page contains a hash. */ @@ -371,7 +359,6 @@ function init() { setAppLocale(); translateHTMLContent(); replaceLegalNoticeLink(); - loadWebpackStyles(); printProjectsNav(); updateView(); listenWindowSize(); diff --git a/src/js/utilities/helpers.js b/src/js/utilities/helpers.js index 470c49c..8cc88c9 100644 --- a/src/js/utilities/helpers.js +++ b/src/js/utilities/helpers.js @@ -6,14 +6,5 @@ function isSmallVw() { return window.innerWidth < 1200; } -/** - * Check if /assets/styles.js exists (Webpack dev mode). - * @returns {Boolean} True if style.js exists ; false otherwise. - */ -async function isStyleJsExists() { - const filePath = 'assets/js/style.js'; - const response = await fetch(filePath); - return response.status === 200; -} - -export { isSmallVw, isStyleJsExists }; +// eslint-disable-next-line import/prefer-default-export +export { isSmallVw }; -- cgit v1.2.3