javascript - browserify 'require' placement -


usually dependencies required in head of file.

var backbone = require('backbone'); var $ = require('jquery'); 

i wonder if correct require in code body. example: template: require('./home.tpl.hbs'),

module.exports = backbone.view.extend({  template: require('./home.tpl.hbs'),  render: function () { ...         return this;     } }); 

it's going work, require function taken nodejs world (commonjs modules) , can read best practices in usage here. point need add local variable @ beggining of file , use wherever want.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -