1
1
# Command Line Interface
2
2
3
3
``` shell
4
- let targetElement_000 = document.querySelector(` :root > body` );
4
+ let targetElement_001 = document.querySelector(` :root > body` );
5
5
6
6
7
- let div_000 = document.createElement(' div' );
8
- let text_000 = document.createTextNode(` I am a ` );
9
- div_000 .appendChild(text_000 );
7
+ let div_001 = document.createElement(' div' );
8
+ let text_001 = document.createTextNode(` I am a ` );
9
+ div_001 .appendChild(text_001 );
10
10
11
- let strong_000 = document.createElement(' strong' );
12
- let text_001 = document.createTextNode(` tea pot` );
13
- strong_000 .appendChild(text_001 );
14
- div_000 .appendChild(strong_000 );
15
- targetElement_000 .appendChild(div_000 );
11
+ let strong_001 = document.createElement(' strong' );
12
+ let text_002 = document.createTextNode(` tea pot` );
13
+ strong_001 .appendChild(text_002 );
14
+ div_001 .appendChild(strong_001 );
15
+ targetElement_001 .appendChild(div_001 );
16
16
```
17
17
18
18
---
19
19
20
20
` jsgenerator ` has several options that can be used in a console here is an example of use below
21
21
22
22
``` text
23
- Usage: jsgenerator [-htV] [-e=<extension>] [--inline-pattern=<inlinePattern>]
23
+ Usage: jsgenerator [-chtV] [-qs] [-e=<extension>]
24
+ [--inline-pattern=<inlinePattern>]
24
25
[-k=<variableDeclaration>] [--path-pattern=<pathPattern>]
25
26
[-s=<targetElementSelector>]
26
27
[--stdin-pattern=<stdinPattern>]
27
28
[--variable-name-generation-strategy=<builtinVariableNameStra
28
29
tegy>] [-i=<inlineContents>...]... [<paths>...]
29
30
Translating files, stdin or inline from HTML to JS
30
31
[<paths>...] file paths to translate content, parsed as HTML
32
+ -c, --comment optional comments
31
33
-e, --ext=<extension> output files' extension
32
34
-h, --help Show this help message and exit.
33
35
-i, --inline=<inlineContents>...
@@ -38,6 +40,23 @@ Translating files, stdin or inline from HTML to JS
38
40
variable declaration keyword
39
41
--path-pattern=<pathPattern>
40
42
pattern for path-based output filenames
43
+ -qs, --query-selector
44
+ What the browser renders depends on whether "document.
45
+ querySelector(':root > body')" is added to the
46
+ output. If added, the browser will render the
47
+ output successfully, it is useful for debugging
48
+ purpose,
49
+ to verify that the js output matches what the
50
+ html input does.
51
+ If not, if the user tries to run the output as
52
+ it is then the browser will not be able to render,
53
+ it will show a blank page.
54
+ So, it depends on what the user wants to do with
55
+ the output.
56
+ "https://jsfiddle.net/", "https://codepen.
57
+ io/pen/" and Browser Console help to give a quick
58
+ feedback.
59
+
41
60
-s, --selector=<targetElementSelector>
42
61
Target element selector
43
62
--stdin-pattern=<stdinPattern>
@@ -46,4 +65,4 @@ Translating files, stdin or inline from HTML to JS
46
65
-V, --version Print version information and exit.
47
66
--variable-name-generation-strategy=<builtinVariableNameStrategy>
48
67
Variable names generation strategy
49
- ```
68
+ ```
0 commit comments