9

i am getting below error while compiling handlebars template with windows CMD. my handlebars client and server both are @1.3.0 please help me to identify where i am going wrong

dashboard.handlebars code--

<ul class="small-block-grid-2 medium-block-grid-2 large-block-grid-2" style="text-align:center;">
    <li>

        <div class="chart" data-percent="{{#getPercent reward_point.point_achived reward_point.point_available}}">
            <span>{{#getPercent reward_point.point_achived reward_point.point_available}}%</span>
            <span style="font-size:.5em;display:inline-block;">{{reward_point.point_achived}}</span>
            <span style="font-size:.5em; color:#005390; display:inline-block;">/{{reward_point.point_available}} RP</span>
        </div>
    </li>
    <li>

        <div class="chart" data-percent="{{#getPercent calorie_budget.point_achived calorie_budget.point_available}}">
            <span>{{#getPercent calorie_budget.point_achived calorie_budget.point_available}}</span>
            <span style="font-size:.5em;display:inline-block;">{{calorie_budget.point_achived}}</span>
            <span style="font-size:.5em; color:#005390; display:inline-block;">/{{calorie_budget.point_available}} cal</span>
        </div>
    </li>
    <li>

        <div class="chart" data-percent="{{#getPercent 30_day_challenge.point_achived 30_day_challenge.point_available}}">
            <span>{{#getPercent 30_day_challenge.point_achived 30_day_challenge.point_available}}</span>
            <span style="font-size:.5em;display:inline-block;">{{30_day_challenge.point_achived}}</span>
            <span style="font-size:.5em; color:#005390; display:inline-block;">/{{30_day_challenge.point_available}} complete</span>
        </div>
    </li>
    <li>

        <div class="chart" data-percent="{{#getPercent physical_activity.point_achived physical_activity.point_available}}">
            <span>{{#getPercent physical_activity.point_achived physical_activity.point_available}}</span>
            <span style="font-size:.5em;display:inline-block;">{{physical_activity.point_achived}}</span>
            <span style="font-size:.5em; color:#005390; display:inline-block;">/{{physical_activity.point_available}} min</span>
        </div>
        </li>
</ul>

error in cmd--

Error: Parse error on line 34:
</ul>      </li>
----------------------^
Expecting 'CONTENT', 'COMMENT', 'OPEN_BLOCK', 'OPEN_INVERSE', 'OPEN_ENDBLOCK', '
OPEN', 'OPEN_UNESCAPED', 'OPEN_PARTIAL', got 'EOF'
    at Object.parseError (C:\Users\User\AppData\Roaming\npm\node_modules\handleb
ars\dist\cjs\handlebars\compiler\parser.js:107:11)
    at Object.parse (C:\Users\User\AppData\Roaming\npm\node_modules\handlebars\d
ist\cjs\handlebars\compiler\parser.js:159:22)
    at HandlebarsEnvironment.parse (C:\Users\User\AppData\Roaming\npm\node_modul
es\handlebars\dist\cjs\handlebars\compiler\base.js:12:17)
    at precompile (C:\Users\User\AppData\Roaming\npm\node_modules\handlebars\dis
t\cjs\handlebars\compiler\compiler.js:435:17)
    at HandlebarsEnvironment.hb.precompile (C:\Users\User\AppData\Roaming\npm\no
de_modules\handlebars\dist\cjs\handlebars.js:22:12)
    at processTemplate (C:\Users\User\AppData\Roaming\npm\node_modules\handlebar
s\bin\handlebars:188:78)
    at C:\Users\User\AppData\Roaming\npm\node_modules\handlebars\bin\handlebars:
194:3
    at Array.forEach (native)
    at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\handle
bars\bin\handlebars:193:8)
    at Module._compile (module.js:456:26)

1 Answer 1

17

You are calling your getPercent-helper with a hash in front of it which makes it a block-statement which then in turn would need to be closed using {{/getPercent}}. Since there shouldn't be any need for it to be a block you probably could just remove the hash from your template.

<div class="chart" data-percent="{{getPercent reward_point.point_achived reward_point.point_available}}">
  <span>{{getPercent reward_point.point_achived reward_point.point_available}}%</span>
  <span style="font-size:.5em;display:inline-block;">{{reward_point.point_achived}}</span>
  <span style="font-size:.5em; color:#005390; display:inline-block;">/{{reward_point.point_available}} RP</span>
</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.