Easy way to precompile Emberjs Handlebar templates with nodejs?

前端 未结 8 1731
耶瑟儿~
耶瑟儿~ 2021-02-01 09:59

I\'m enjoying emberjs a lot and would like to take the next step in a couple of my small, mobile apps and precompile my Ember/Handlebars templates as part of my build process.

8条回答
  •  北荒
    北荒 (楼主)
    2021-02-01 10:27

    window object can be mocked by jsdom

        var jsdom = require("jsdom").jsdom;
        global.document = jsdom("");
        global.window = document.createWindow();
        global.$ = global.jQuery = window.$ = window.jQuery = require("jquery");
        global.Handlebars = window.Handlebars = require('handlebars');
        global.Application = window.Application = {};
        require('ember.js');
    

    and now you can run anything from Ember including Ember.Handlebars.compile

提交回复
热议问题