Giter Site home page Giter Site logo

Comments (4)

toranb avatar toranb commented on July 18, 2024

I tried this early on but didn't have any luck unless I built a full dom. The below complains "ReferenceError: Handlebars is not defined" (assuming because the precompiler expects it to be globally available and what I'm doing doesn't seem to set that up correctly)

  var handlebars = exports.Handlebars = require('' + vendor + '/handlebars-1.0.0-rc.3.js');
  var ember = exports.Ember = require('' + vendor + '/ember.min.js');
  var compiler = exports.precompile = require('' + vendor + '/ember-template-compiler.min.js');

  var input = precompile(template['content']).toString();

What am I doing wrong above?

from django-ember-precompile.

toranb avatar toranb commented on July 18, 2024

Also I've tried just using pure handlebars but the output doesn't seem to be the same (blank screen in my ember apps)

handlebars = exports.handlebars = require('handlebars');
var input = handlebars.precompile(template['content']).toString();
var output = "Ember.TEMPLATES['" + template['name'] + "'] = Ember.Handlebars.template(" + input + ");";

from django-ember-precompile.

apmorton avatar apmorton commented on July 18, 2024

I ran into the same issue with my implementation with execjs and the simplest solution was to embed handlebars in the ember-template-compiler.js file

The issue is the whole thing is scoped in an anonymous function so it doesn't find the handlebars lib

Take a look at https://github.com/Juvenal1228/ember-compressor-compiler

from django-ember-precompile.

toranb avatar toranb commented on July 18, 2024

It looks like you have a great solution that is 100% python so for now I'll close this out -if people are looking for something npm focused my module works, but if they want to avoid the overhead and prefer the python based approach your module is another great option

Thanks for opening this issue to reduce the overhead with my module but at this time I still don't have a "simple" solution that is just 1 JS file -I'll continue to watch the ember / handlebars npm space as well -hopefully they add something like "ember-precompiler" that I could use from npm directly :)

from django-ember-precompile.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.