framework7io / framework7-loader

MIT License
8 stars 7 forks source link

Custom helpers compiled incorrectly #3

Open luran813 opened 5 years ago

luran813 commented 5 years ago

1.template-helpers.js


Template7.registerHelper('steps', function(step1, step2) {
  var str = 
    '<div class="steps">'+
      '<div class="step1">' + step1 + '</div>' +
      '<div class="step2">' + step2 + '</div>' +
    '</div>';
  return str;
});
module.exports = ['steps'];
  1. .f7.html content is: {{steps 'step1' 'step2'}}

  2. webpack.config.dev.js

        test: /\.f7.html$/,
        use: [
          'babel-loader',
          {
            loader: 'framework7-component-loader',
            options: {
              helpersPath: './src/js/template-helpers.js',
              partialsPath: './src/template/',
              partialsExt: '.f7p.html'
            }
          }
        ],
      },
  3. Compile error :

    ERROR in ./src/../aa.f7.html                                                                            
    Module build failed (from ./node_modules/framework7-component-loader/lib/index.js):                                     
    Error: Template7: Missing helper: "steps"                                                                               
    at Template7Class.compile (D:\luran\projects\xinge-pk-copy\bmanagersys\node_modules\template7\dist\template7.js:590:17)                                                                                                                     
    at Function.compile (D:\luran\projects\xinge-pk-copy\bmanagersys\node_modules\template7\dist\template7.js:655:21)   
    at Object.loader (D:\luran\projects\xinge-pk-copy\bmanagersys\node_modules\framework7-component-loader\lib\index.js:161:43)                                                                                                                 
shastox commented 5 years ago

Нужно добавить steps в этот файл: https://github.com/framework7io/framework7-template-webpack/blob/master/src/template7-helpers-list.js

kriboogh commented 4 years ago

I also get this error:

Also get the missing helper error when opening the tab (framework 5.7.8)

shastox commented 4 years ago

Нужно перезапустить webpack

kriboogh commented 4 years ago

Already did that (several times), doesn't work.