-
Notifications
You must be signed in to change notification settings - Fork 69
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
Plates v1.0.0 #110
Plates v1.0.0 #110
Conversation
This needs tests before we can merge it in. |
This also completely breaks browser support. |
@3rd-Eden Please give examples of how it breaks browser support so that it can be fixed. It's worth noting that I haven't tested this in the browser yet. Sorry that wasn't in the pull request description. @mmalecki Tests will be out soon, this PR isn't ready yet. Just a place to show the progress. @hij1nx The API will actually be the same as the current API, with a few additions. That was one of the stipulations of it being recoded. I've been running time tests between the old code and the new code, and I haven't seen a major performance hit by using regular expressions in this manner. If you find a way that it takes longer, please let me know so I can look into ways that it could be improved. I really don't think iterating through each character, as it was previously, is exactly a fast method of doing things either. |
Can't all current tests be ported? Most are use case tests and some target specific fixes, see test 42 for example. Concerning browser support Also there is a massive pull request open, I'm not sure how legit it is. But contribution would be hurt if we just ignored that. |
@Southern basically all ES5 stuff that your using should be banished. So stuff like:
@Swaagie The current version is working from IE6 to whatever IE and some older firefox versions like FF3. But basically following http://yuilibrary.com/yui/environments/ would probably yield enough support. |
@Swaagie I haven't tested all of the current tests yet, as it's not complete enough (mapping isn't in here) to test yet. The current tests may be fine for all I know. @3rd-Eden I know the "y" flag isn't supported in regex in all browsers. It doesn't force the "y" flag. It's just checking the source of the regular expression to see if the "y" flag is active. It's not actually adding it into the regex unless the user does. If all we're missing is a few functions in IE, why can't those functions just be added into the current code? It seems that only IE < 9 has problems with ES5, which doesn't surprise me at all. @hij1nx I understand that Mustache has a huge following, including myself. However, Plates doesn't function the same as Mustache. So using Mustache as a comparison is pretty moot. Until I'm told otherwise, or someone can point me to some performance stats showing that it's taken a major performance hit, this recode will continue. /cc @indexzero |
@Southern This is a good start; your parser looks pretty minimal. Contrary to other comments on this thread, regular expressions are fast in Javascript (especially V8). The need for a lexer-pass and a parser pass is obvious, and it's nice not to have to rely on Look forward to what you come up with. |
same question. i forked plates.js several months ago and took some time to go through all the commits on this project to include them in my fork, just to realize, that they were only commit to polish stuff. Basically the project as is works for me, but i wonder if the code could be made smaller and maybe there is room for performance optimization. thx :-) |
@davidchase In case of this pull request it cannot and will not be merged in until all points expressed above are addressed. In addition to that the usage of this module has been declining at Nodejitsu as we've found it quite hard and super annoying to maintain template's rendering process in two different locations. So I would say, we welcome new contributors that want to help out with maintaining and moving this project forward. |
@3rd-Eden is there another module you guys use at Nodejitsu instead of this one? |
@davidchase check out https://github.com/bigpipe/, https://github.com/nodejitsu/contour and https://github.com/nodejitsu/browsenpm.org for an idea of what we are working with these days. |
@jcrugzz those are all excellent modules but I was hoping for something similar to plates... I really was drawn to the dsl free lack of |
I'm pretty attracted to "programmatic template systems" (that's what they are called in a blog post from strongloop) For example:
I always thought, with those templating language, it should be easy to do live content updates "data binding", because the tags tell me exactly where to update the data. This could be combined with I'm not so familiar with the virtual DOM concept and what else might be necessary to optimize performance - but i imagine, that i could get a pretty nice templating solution with this approach. I actually wonder why nobody tried to go down that route yet - or if somebody did - i'm always happy to learn about cool projects :-) |
@davidchase As we've moved completely away from this pattern, we're using nothing else like this. The modules that we use are the once's that @jcrugzz mentioned. Our BigPipe system allows each layout component to be written in different template language if people want to do so, we're currently using @serapath Sure, it's easy to update content using data binding but the problem starts when you need to work your layout and start moving elements which causes everything to break as your mapping is no longer up to date. This requires you to edit other files which contains these mappings which is becoming an increasing burden for more complex layouts. "virtual dom" wouldn't really yield any major benefits on the server as there isn't any new DOM that needs to be repainted. You are just manipulating in memory objects with function calls. |
Can you elaborate what you mean? What is the problem about re-positioning? |
Closing this due to age. This project is formally deprecated. Will be adding a notice soon. |
Plates has been pretty abused over the past year. It's time that it got some love! We've been rebuilding it from the ground up. Here are some of the things that this recode aims to fix, or has already fixed:
Plates.bind
.append
actually append, rather than overwriting all of the HTML in the tag.This code is currently incomplete, no tests are currently provided, and any of the methods in this code could change at any time. There will be completely new documentation, once the code is complete, that will outline all of the methods that are available in the actual release.
Pull requests are welcome if you would like to contribute to this code.