Skip to content

Commit

Permalink
Use str.split(search).join(replacement)
Browse files Browse the repository at this point in the history
  • Loading branch information
neiesc committed Jun 20, 2020
1 parent eabe86f commit 28910b1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/assets/js/helpers/replaceAll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (text, search, replacement) {
return text.split(search).join(replacement)
}
11 changes: 6 additions & 5 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,12 @@ <h4>Social Networks</h4>

<div id="particles-js"></div>

<% 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('')
%>
</div>

<!-- scripts -->
Expand Down
12 changes: 7 additions & 5 deletions src/palestras/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ <h3 class="uk-card-title">

<div id="particles-js"></div>

<% 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('')
%>
</div>

<!-- scripts -->
Expand Down
12 changes: 7 additions & 5 deletions src/podcasts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ <h3 class="uk-card-title">Podcasts</h3>

<div id="particles-js"></div>

<% 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"')
%>
</div>

<!-- scripts -->
Expand Down

0 comments on commit 28910b1

Please sign in to comment.