sstephenson / eco

Embedded CoffeeScript templates
MIT License
1.71k stars 70 forks source link

Reduce code duplication with multiple compiled eco templates #54

Open Philipp15b opened 12 years ago

Philipp15b commented 12 years ago

So I wanted to use eco client-side and I noticed that eco pre-compiles all the helper functions in every single one of the compiled templates.

This could be solved by maybe allowing the compiler to use a global eco object which would then contain the helpers.

This was also mentioned in #48.

al6x commented 12 years ago

Yes, would be nice to prevent it, maybe something like

eco = require 'eco'

bundle = [
  eco.head()
  eco.precompileWithoutHead(tmpl1)
  eco.precompileWithoutHead(tmpl2)
  ....
].join("; \n")
aeischeid commented 12 years ago

+1 for this optimization! We just noticed this duplication as well, and were immediately looking for a way to cut it out, but got lost in the details of why it is there in the first place.

al6x commented 12 years ago

Any news for this? At least is this feature will be accepted or rejected?