From 28910b19eebe97f3ff6dfc7a20e8aee58466bbe1 Mon Sep 17 00:00:00 2001 From: Edinei Cavalcanti Date: Sat, 20 Jun 2020 19:36:43 -0300 Subject: [PATCH 1/2] Use str.split(search).join(replacement) --- src/assets/js/helpers/replaceAll.js | 3 +++ src/index.html | 11 ++++++----- src/palestras/index.html | 12 +++++++----- src/podcasts/index.html | 12 +++++++----- 4 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 src/assets/js/helpers/replaceAll.js diff --git a/src/assets/js/helpers/replaceAll.js b/src/assets/js/helpers/replaceAll.js new file mode 100644 index 00000000..b33483cb --- /dev/null +++ b/src/assets/js/helpers/replaceAll.js @@ -0,0 +1,3 @@ +module.exports = function (text, search, replacement) { + return text.split(search).join(replacement) +} diff --git a/src/index.html b/src/index.html index 4bb89696..ba0e11cf 100644 --- a/src/index.html +++ b/src/index.html @@ -243,11 +243,12 @@

Social Networks

- <% var template = require("html-loader!./shared/menu.html"); %> <%= - template - .replace('${homeActive}','class="uk-active"').replace('${homeActive}','class="uk-active"') - .replace('${palestrasActive}', '').replace('${palestrasActive}', '') - .replace('${podcastActive}', '').replace('${podcastActive}', '') %> + <% var template = require("html-loader!./shared/menu.html"); %> + <%= template + .split('${homeActive}').join('class="uk-active"') + .split('${palestrasActive}').join('') + .split('${podcastActive}').join('') + %> diff --git a/src/palestras/index.html b/src/palestras/index.html index 916318be..2cc0cd07 100644 --- a/src/palestras/index.html +++ b/src/palestras/index.html @@ -154,11 +154,13 @@

- <% var template = require("html-loader!../shared/menu.html"); %> <%= - template .replace('${homeActive}','').replace('${homeActive}','') - .replace('${palestrasActive}', - 'class="uk-active"').replace('${palestrasActive}', 'class="uk-active"') - .replace('${podcastActive}', '').replace('${podcastActive}', '') %> + <% var template = require("html-loader!../shared/menu.html"); %> + <%= + template + .split('${homeActive}').join('') + .split('${palestrasActive}').join('class="uk-active"') + .split('${podcastActive}').join('') + %> diff --git a/src/podcasts/index.html b/src/podcasts/index.html index 53dfe931..fd80a024 100644 --- a/src/podcasts/index.html +++ b/src/podcasts/index.html @@ -96,11 +96,13 @@

Podcasts

- <% var template = require("html-loader!../shared/menu.html"); %> <%= - template .replace('${homeActive}','').replace('${homeActive}','') - .replace('${palestrasActive}', '').replace('${palestrasActive}', '') - .replace('${podcastActive}', - 'class="uk-active"').replace('${podcastActive}', 'class="uk-active"') %> + <% var template = require("html-loader!../shared/menu.html"); %> + <%= + template + .split('${homeActive}').join('') + .split('${palestrasActive}').join('') + .split('${podcastActive}').join('class="uk-active"') + %> From 12afa1ff1a1b6cf86273fc6dad38121e7ee5d1e6 Mon Sep 17 00:00:00 2001 From: Edinei Cavalcanti Date: Sat, 20 Jun 2020 19:38:18 -0300 Subject: [PATCH 2/2] pretty --- src/assets/js/helpers/replaceAll.js | 3 --- src/index.html | 8 +++----- src/palestras/index.html | 9 +++------ src/podcasts/index.html | 9 +++------ 4 files changed, 9 insertions(+), 20 deletions(-) delete mode 100644 src/assets/js/helpers/replaceAll.js diff --git a/src/assets/js/helpers/replaceAll.js b/src/assets/js/helpers/replaceAll.js deleted file mode 100644 index b33483cb..00000000 --- a/src/assets/js/helpers/replaceAll.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (text, search, replacement) { - return text.split(search).join(replacement) -} diff --git a/src/index.html b/src/index.html index ba0e11cf..1b91bb4a 100644 --- a/src/index.html +++ b/src/index.html @@ -243,11 +243,9 @@

Social Networks

- <% var template = require("html-loader!./shared/menu.html"); %> - <%= template - .split('${homeActive}').join('class="uk-active"') - .split('${palestrasActive}').join('') - .split('${podcastActive}').join('') + <% var template = require("html-loader!./shared/menu.html"); %> <%= + template .split('${homeActive}').join('class="uk-active"') + .split('${palestrasActive}').join('') .split('${podcastActive}').join('') %> diff --git a/src/palestras/index.html b/src/palestras/index.html index 2cc0cd07..d8f17707 100644 --- a/src/palestras/index.html +++ b/src/palestras/index.html @@ -154,13 +154,10 @@

- <% var template = require("html-loader!../shared/menu.html"); %> - <%= - template - .split('${homeActive}').join('') + <% var template = require("html-loader!../shared/menu.html"); %> <%= + template .split('${homeActive}').join('') .split('${palestrasActive}').join('class="uk-active"') - .split('${podcastActive}').join('') - %> + .split('${podcastActive}').join('') %> diff --git a/src/podcasts/index.html b/src/podcasts/index.html index fd80a024..a4d448ea 100644 --- a/src/podcasts/index.html +++ b/src/podcasts/index.html @@ -96,13 +96,10 @@

Podcasts

- <% var template = require("html-loader!../shared/menu.html"); %> - <%= - template - .split('${homeActive}').join('') + <% var template = require("html-loader!../shared/menu.html"); %> <%= + template .split('${homeActive}').join('') .split('${palestrasActive}').join('') - .split('${podcastActive}').join('class="uk-active"') - %> + .split('${podcastActive}').join('class="uk-active"') %>