Simple use of the jade template engine

Source: Internet
Author: User
①. The first word of the feature is a tag, and some unidentifiable tags can be used as code, such as adding tags in the each for case if else if unless Zen coding style, as shown in. <Div class = "Nb" id = "hello"> </div> indentation generated by Nb # Hello must be integrated with tab or space. Otherwise, an error is reported, indicating the nested relationship through indentation, this is important! For example, p A generates <p> <A> </a> </P> ②. coding and HTML fragments-followed by code # {var }! {Var} = var! = Var: The variable value can be output in the HTML fragment | followed by a text tag. added compliance. indicates that the next line of nested text is plain text ③, nested include jade Path 4, inherit extends Jade Path 5, comment // single line comment or the next line of nested text are comments 6, mixins a powerful tool to reduce repetitive work, define a task Block
 1 mixin article(title) 2   .article 3     .article-wrapper 4       h1= title 5       if block 6         block 7       else 8         p No content provided 9 10 +article(‘Hello world‘)11 12 +article(‘Hello world‘)13   p This is my14   p Amazing article

After rendering changes

 1 <div class="article"> 2   <div class="article-wrapper"> 3     

 

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.