Razor. js, implemented based on JavaScript Razor

Source: Internet
Author: User

Hello everyone, I have previously created the JS template wheel Otmpl. Although it is barely good, it is terrible compared with the simplicity and elegance of MVC Razor. After a few days of research, I finally presented the first version After referring to the code of some cool people outside China. You are welcome to make a discussion.

Supported Razor features
  • If-else judgment.
  • Do-while loop.
  • While loop.
  • For loop.
  • Helper method.
  • '* Comment *'.
Sample Code 1 (to be used in MVC, I use the "'" symbol under the Esc key to replace "@". The JS-based micro Razor engine '(">" + index) user number is 1' model. message 'model. dateView Code download [click here to download] This version is not very mature and the Code is not obfuscated. If you do not like "'", you can modify scripts/Razor. base. configure "razorAnchor" in js. I will not introduce much about Razor syntax. If you have better optimization suggestions, please leave a message! If you like this article, please refer ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.