Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated dot_core for backwards compatibility so that the examples can work,,, #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NathanaelA
Copy link

Updated browsersample example to point to non-minified dot.js file
Updated README.md to have instructions on how to build the client side dot.js

… work.

Updated browsersampel example to point to non-minified dot.js file
Updated README.md to have instructions on how to build the client side dot.js
@printercu
Copy link
Owner

Hi! Thanks for PR. Sorry for poor documentation - I haven't updated it since major version update.

But I think it'll be better to write npm task to compile browser version. Indeed I had no one yet 'cause i use nrockets (similar to sprockets) to concat & compile it into js.

About compatibility with original doT. I knew about that incompatibilities and so I incremented major version number. However one can add old behaviour with

# dot_custom.coffee
# ...
dot = new DotCore settings
dot.template = (tmpl, compileParams = {}) ->
  # Compatibility with original dot.template command(templ,,def)
  if arguments.length == 3 && arguments[2]?
    compileParams.def = arguments[2]
  @compile tmpl, compileParams

@NathanaelA
Copy link
Author

Not a problem -- I do like the way you separated out the tags in your rewrite of the dot.
I was just was trying to learn how to use the dot templates and none of the examples work unless you add those compatibility shims into it.

You can do it either your way (make a new template command that has the logic before it calls compile) or my way (link the prototype, and add two lines of code to compile). It would help people to use your version, if it was backwards compatible with the original version and all the original versions examples...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants