Group Details Private

Staff

Employees & Interns of NodeBB

Member List


  • RE: Math editor posted in NodeBB Plugins
  • RE: Tag cloud is bad

    So why do you bring up tag clouds? Do you think the tags page should be changed or removed, or what?

    The tag cloud on the home page of this forum is a small number of links. The tags page is a tag cloud, but it's not on every page so the same ideas don't apply as for sidebar tag clouds.

    posted in General Discussion
  • RE: Plugin - Google Recaptcha

    https://github.com/akhoury/nodebb-plugin-spam-be-gone#from-03x-to-04x

    Spam Be Gone 0.4.x uses Google's "No CAPTCHA reCAPTCHA" which does not support the old public/private keys, so you need to generate new ones and replace the old ones in your NodeBB Admin Panel, or you will see an error instead of the captcha image, visit this page to do so: https://www.google.com/recaptcha/admin#list

    posted in Technical Support
  • RE: Which version of Node.js to install on CentOS 7?

    Yeah, none of that stuff about memory usage is correct AFAIK.

    Use nvm to install Node v6.

    posted in General Discussion
  • RE: How easy is it to setup nodebb on VPS?

    It's fairly simple as long as you have some experience with the Linux command line.

    posted in General Discussion
  • RE: Connexion has been lost.. reconnecting !

    @izio-romain can you describe what is happening in more detail.

    posted in Technical Support
  • RE: Unable to post new topics or reply to existing ones

    @btc npm install --save modifies package.json, so that's probably what changed it. Run git reset --hard origin/master to both reset package.json and to pull the latest changes on the master branch.

    posted in Technical Support
  • RE: Introducing Our New Templating Engine

    @shard it's in the benchpressjs branch of the nodebb repository at the moment.

    posted in Announcements
  • RE: How can I edit {post.content}

    @sam-nguyen this behavior is in the composer module, not in any template. I don't think it's possible to change it right now. I'll look into it later though.

    posted in NodeBB Development
  • Introducing Our New Templating Engine

    Hi everybody,

    Over the past year I've been working on building a new templating engine from the ground up. I did this for several main reasons:

    • templates.js was buggy and hard to maintain
    • templates.js was orders of magnitude slower compared to other templating engines
    • templates.js uses orders of magnitude more CPU time than other templating engines
    • Curiosity surrounding parsers and compilers, especially dealing with how Babel and JS AST formats work

    Why was templates.js slow?

    It works opposite of most templating engines, iterating over the entire data object, instead of fetching values from it based on template tokens. This meant iterating through the template string possibly hundreds of times per request.

    templates.js was begging for a replacement. My solution:

    Benchpress

    Benchpress is a brand new templating engine built from the ground up to be feature-rich and very fast. It is mostly backwards compatible with templates.js, and in some areas providing more flexible syntax.

    How is it so fast?

    Benchpress compiles template files into Javascript functions composed of string concatenation. For example, the following template:

    I love {{forum}} because it uses {{templater}}!
    

    Is compiled into this Javascript module:

    (function (factory) {
            if (typeof module === 'object' && module.exports) {
                    module.exports = factory();
            } else if (typeof define === 'function' && define.amd) {
                    define(factory);
            }
    })(function () {
            function compiled(helpers, context, get, iter, helper) {
              return 'I love ' + get(context && context['forum']) + ' because it uses ' + get(context && context['templater']) + '!';
            }
    
            return compiled;
    });
    

    This puts Benchpress among the fastest templating libraries available. Faster than Handlebars, EJS, underscore, and Pug (Jade). It's almost 40x faster than templates.js was.

    Breaking changes between templates.js and Benchpress

    I tried to make Benchpress as backwards compatible as possible. Most existing templates should work fine. However, there are a few instances where Benchpress will behave differently.

    • If you are iterating over an object or array, you can't access it's properties directly, since you can use {obj.prop} to mean the prop property of each element. templates.js supported both of these, but due to the ambiguity of the syntax, Benchpress requires you to use {../../obj.prop} to access that specific property.
    • Somehow templates.js supports iterating over deep values. For example, for this data: { obj: { arr: [4, 7, 2] } } and this template: <!-- BEGIN arr -->{@value}<!-- END arr --> it would output 472, even though arr isn't at the top level of the input data. Obviously, this is not supported in Benchpress.
    • Another crazy thing that templates.js supported was reversing the iterators in the template, so <!-- BEGIN arr1 --><!-- BEGIN arr2 --> behaved the same as <!-- BEGIN arr2 --><!-- BEGIN arr1 -->. This is unsupported in Benchpress because it makes no sense.

    By far, the largest breaking change in Benchpress is that client-side template compilation is unsupported. In fact, using Benchpress.parse(template, data) is entirely unsupported. There is a new function only available on the server side, Benchpress.compileParse(template, data, callback) which will compile a given template and then execute it with the given data. You must otherwise precompile templates before using them client-side. Any templates in NodeBB, themes, and plugins that are provided normally will continue to be compiled automatically.

    I'm very excited to introduce you all to Benchpress, and for the future it has with NodeBB! Benchpress is planned on being shipped with NodeBB in an upcoming major release.

    Edit: just to clarify, client-side parsing, using Benchpress.parse(templateName, data, callback) is still available client side. Client side compilation is unsupported, but client side parsing is still supported.

    Edit2: I forgot to mention that this forum is currently powered by Benchpress.

    posted in Announcements

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.