Preliminary understanding pug

A preliminary understanding pug

1. The so-called pug is what we said before jade, which is a kind of written procedure code by indenting the way, in the process of compiling, we need not consider whether the label closed issue. In addition, this compilation method speeds up the code we write, but also to provide a convenient code reuse.

2. Before learning basic grammar pug, pug must first understand the use of the command line, for example:

doctype html

    html

    head

            title aaa

    body

In documents written inside the above procedure, and then save to xxx.pug format, amassing terminal command input pug xxx.pug, press the Enter key, we project the compiler before returning, you will find appear in the compiler xxx.html file with the same name xxx, after opening the foundation will find html format has been printed out. But there is a problem, typesetting basic format is not as we usually written format, here we need to be converted to HTML when entering commands pug -P xxx.pug pug format; you can get what we want the format . To automatically updated in real-time code that appears after we modified the style, so we can enter the terminal command: pug -P -w xxx.pug; do not want to continue to be updated as shortcuts: ctrl + c.

3. Set Path

If you do not want to enter HTML compiled files in the current directory, but there is a demand custom directory, you need to set -o parameter

The following settings, index.html inputted to a directory below, if a directory does not exist, a new directory:

pug index.pug -o a

4. mass compile:

Assuming that all pug files compiled href, you can write: pug href

5. Structure Grammar:

label

[Tree]

By default, the (partially or followed by white characters) at the beginning of each line of text written in the name of the HTML tags. Use indentation to indicate the nesting relationship between the labels, which can construct a tree structure of the HTML code

ul

li Item A

li Item B

li Item C       .

Continuously updated, we welcome the advice!

Guess you like

Origin www.cnblogs.com/homehtml/p/11872752.html