Browserify如何适合初学者



我正在读一篇关于Ampersand.js的非常有趣的文章。这似乎是一篇关于backbone.js 的非常酷的文章

符号和视图部分,它有一段代码,说明您可以使用browserfy,在这种情况下,我不知道browserfy将如何适应。

var AmpersandView=require('ampersand-view'(;

var ProfileView = new AmpersandView.extend({
    // A View template is not more than a string of HTML. 
    *******
    RIGHT HERE --->>> // You can add in a hardcoded string, use a function that returns a template, or use something like Browserify.
    *******
    // Please do make sure the template only has one root element, otherwise it won't be rendered! 
    template: "<div> <span data-hook='name'></span> <span class='email'></span> <a data-hook='edit'>edit</a> </div>",
    // Bind state to DOM element.
    bindings: {
         ...and so forth

什么意思是"或使用类似browserfy">的东西。我想我理解browsrify的目的,但我不确定它会如何适应这里。谢谢你的提示。

Ampersand.js是设计的,用于使用browserfy(或其他依赖处理工具,如Webpack(,因为它由CommonJS模块组成。我不确定它是否能与ES6中引入的import一起工作,但无论如何,您都希望将所有javascript捆绑在一个文件中(或者至少捆绑在其中的几个文件中(。我不知道你是如何理解为什么创建browserfy的,但捆绑几个模块是它存在的目的(如果你愿意,你也可以做其他事情(。

附言:你没有想过require是从哪里来的吗?

最新更新