Giter VIP home page Giter VIP logo

Comments (10)

baryshev avatar baryshev commented on August 28, 2024

This feature planned for next version.

from ect.

kesavkolla avatar kesavkolla commented on August 28, 2024

Awesome. A batch compiler for ect templates and the output can be directly served to browser. It would be great if this can be integrated with Angular.js. Also cool thing would be to integrate with CodeKit so that it can auto compile the ect templates. I'd love to see this feature soon.

from ect.

eliseumds avatar eliseumds commented on August 28, 2024

Hey guys!

First of all, I would like to thank everyone, this is project is really impressive and helpful.

I've adapted the code so I can precompile the templates. If anyone is interest, please check my fork: https://github.com/eliseumds/ect

from ect.

aeischeid avatar aeischeid commented on August 28, 2024

Previously we used eco with spine.js and hem. I would love to replace eco with ect in the spine.js docs, example apps and and hem and all that but precomplilation would be a requirement. I will keep an eye out for this feature landing. looks like you guys are doing good work. Keep going!

from ect.

baryshev avatar baryshev commented on August 28, 2024

First version of command-line compiler released just now (with v0.5.0). It have a basic functionality for now, but will be improved in future.

from ect.

mwcollins avatar mwcollins commented on August 28, 2024

Hey All, What's the status of precompiling templates on the client side? I love ECT, but this is the only thing preventing me from integrating it. Currently the pre-complier outputs an anonymous function... how would one integrate the compiled output to be renderable by an ECT object instance?

I dug into the source a little bit... I was thinking maybe adding a method like:

renderer.register({ name:'foo', compiled:(function(){}) });

... this would add a record to the cache object internally

Then I would be able to:

renderer.render('foo',{});

I'll submit a patch if I end up writing it, but wanted to get your thoughts.

from ect.

baryshev avatar baryshev commented on August 28, 2024

If you need to serve all precompilied templates to client in one script/html (without ajax lazy load) you can use this syntax:

var renderer = new ECT({
    root : {
        foo: 'ectPrecompilledFuncitonHere',
        bar: 'ectPrecompilledFuncitonHere'
    }
});

After that you can use template foo and bar in your code.

from ect.

mwcollins avatar mwcollins commented on August 28, 2024

Solid, thanks... is that the string source or is it the function reference?

from ect.

baryshev avatar baryshev commented on August 28, 2024

This is a string as it outputted by ect command line tool.

from ect.

brian-mann avatar brian-mann commented on August 28, 2024

Unfortunately, I find this woefully inadequate. In my opinion ECT beats ECO all around, except for the fact that you're coupled to a server side implementation, and lazy loading the templates async.

My project has hundreds of templates - I doggedly control when those templates are loaded on the client. When a user visits a new page, I send down all the JS including the template code as one file. That way, the minimal code is loaded when the page first loads, but complete "page modules" are loaded lazily when they're needed.

It wouldn't make send to send the templates 1 file at a time on demand.

So that means that there needs to be a way to precompile them into a global namespace. Many templates already do this, ECO, EJS, Handlebars, Jade, etc. ECT not providing this is a real deal breaker.

from ect.

Related Issues (20)

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.