Skip to content

New helper templateIs to allow dynamic classes based on template name#3

Open
adamauckland wants to merge 1 commit intomasterfrom
feature/allow-navigation-active
Open

New helper templateIs to allow dynamic classes based on template name#3
adamauckland wants to merge 1 commit intomasterfrom
feature/allow-navigation-active

Conversation

@adamauckland
Copy link
Collaborator

Ditches the first handlebars plugin for gulp-hb which gives more useful information like the file name. Docs https://www.npmjs.com/package/gulp-hb

Added a custom helpers to get the template file name.

Also added a custom helper to return a classname if the current file template is a specific name:

{{ templateIs @file "index.hbs" "active" }}

returns "active" if the current template is index.hbs. Returns nothing otherwise.

This can be added to a

<div class="  {{ templateIs @file "index.hbs" "active" }}   "> 

To show the active link in a nav.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant