@@ -10,6 +10,37 @@ Render-js keeps specificity extremely low by generating tachyons (single purpose
10
10
11
11
The programmer simply defines what css properties an HTML element should have. You can even define media queries for responsive styling.
12
12
13
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
14
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
15
+ ## Contents
16
+
17
+ - [ Genesis] ( #genesis )
18
+ - [ Generation 1: HTML] ( #generation-1-html )
19
+ - [ Core concepts (syntax)] ( #core-concepts-syntax )
20
+ - [ HTML element functions] ( #html-element-functions )
21
+ - [ HTML attribute object] ( #html-attribute-object )
22
+ - [ Style attribute object] ( #style-attribute-object )
23
+ - [ HTML: Examples:] ( #html-examples )
24
+ - [ HTML: ECMAscript 2015 example] ( #html-ecmascript-2015-example )
25
+ - [ HTML: Javascript 1.6 example] ( #html-javascript-16-example )
26
+ - [ HTML: Result] ( #html-result )
27
+ - [ Generation 2: NCSS] ( #generation-2-ncss )
28
+ - [ Generation 3: DOM] ( #generation-3-dom )
29
+ - [ DOM: ECMAscript 2015 example] ( #dom-ecmascript-2015-example )
30
+ - [ Generation 4: OBJ] ( #generation-4-obj )
31
+ - [ Generation 5: CLASS (current generation)] ( #generation-5-class-current-generation )
32
+ - [ Examples] ( #examples )
33
+ - [ How to include in Enonic XP app (does not apply to Node.js)] ( #how-to-include-in-enonic-xp-app-does-not-apply-to-nodejs )
34
+ - [ HTML: How to use it in Javascript 1.6 (Enonic XP 6.12.2)] ( #html-how-to-use-it-in-javascript-16-enonic-xp-6122 )
35
+ - [ HTML: How to use it in ECMAscript 2015 (Node.js, Enonic XP 7)] ( #html-how-to-use-it-in-ecmascript-2015-nodejs-enonic-xp-7 )
36
+ - [ Vision / goal] ( #vision--goal )
37
+ - [ New IDEA: Non Cascading Scaleable Styling] ( #new-idea-non-cascading-scaleable-styling )
38
+ - [ Definition] ( #definition )
39
+ - [ Compatibility] ( #compatibility )
40
+ - [ Changelog] ( #changelog )
41
+
42
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
43
+
13
44
## Genesis
14
45
15
46
I started programming Render-js as an alternative to thymeleaf, but it quickly grew into much more. Everytime I got a major idea I developed it as a new variant without changing the previous one:
62
93
]);
63
94
```
64
95
65
- ### HTML attribute object
96
+ #### HTML attribute object
66
97
67
98
An html attribute looks like this (EBNF):
68
99
``` ebnf
@@ -90,7 +121,7 @@ data-prop="value"
90
121
91
122
I have found an exception: The SVG attribute named viewBox. It is case-sensitive. So I simply don't dasherize that one. Make an issue on github if you run into any other case-sensitive HTML/SVG attributes.
92
123
93
- ### Style attribute object
124
+ #### Style attribute object
94
125
95
126
An html style attribute consists of is a semicolon seperated key value pair list. (EBNF):
96
127
@@ -120,15 +151,16 @@ CSS property names contains dashes, which JS property names also can, but needs
120
151
style="color:white;background-color:black"
121
152
```
122
153
154
+ ### HTML: Examples:
123
155
124
- ###### HTML: ECMAscript 2015 example
156
+ #### HTML: ECMAscript 2015 example
125
157
126
158
``` js
127
159
import {p , render } from ' render-js/html.es' ;
128
160
render (p ({style: {backgroundColor: ' white' }}, ' Hello world' ));
129
161
```
130
162
131
- ###### HTML: Javascript 1.6 example
163
+ #### HTML: Javascript 1.6 example
132
164
133
165
``` js
134
166
var R = require (' render-js/dist/html.js' );
@@ -137,7 +169,7 @@ var p = R.p;
137
169
render (p ({style: {backgroundColor: ' white' }}, ' Hello world' ));
138
170
```
139
171
140
- ###### HTML: Result
172
+ #### HTML: Result
141
173
``` html
142
174
<p style =" background-color :white " >Hello world</p >
143
175
```
@@ -153,7 +185,7 @@ This is when I figured out accessing and modify the dom could be useful.
153
185
154
186
All the features of this generation should be present in the newest generation, so you should probably use that instead.
155
187
156
- ###### DOM: ECMAscript 2015 example
188
+ #### DOM: ECMAscript 2015 example
157
189
158
190
``` js
159
191
import { Dom , doctype , html , head , title , style ,
@@ -254,15 +286,14 @@ This is when I started thinking about keeping the Dom object as small as possibl
254
286
## Examples
255
287
256
288
257
-
258
289
### How to include in Enonic XP app (does not apply to Node.js)
259
290
``` groovy
260
291
dependencies {
261
292
include 'com.enonic.lib:render-js:1.20.0'
262
293
}
263
294
```
264
295
265
- ###### HTML: How to use it in Javascript 1.6 (Enonic XP 6.12.2)
296
+ ### HTML: How to use it in Javascript 1.6 (Enonic XP 6.12.2)
266
297
267
298
``` js
268
299
var R = require (' /lib/render-js/index.js' );
@@ -285,7 +316,7 @@ exports.get = function(request) {
285
316
} // exports.get
286
317
```
287
318
288
- ###### HTML: How to use it in ECMAscript 2015 (Node.js, Enonic XP 7)
319
+ ### HTML: How to use it in ECMAscript 2015 (Node.js, Enonic XP 7)
289
320
290
321
``` js
291
322
import R , { render , doctype , html , head , title , body , main , h1 , form } from ' render-js' ;
@@ -364,137 +395,132 @@ In terms of extendability, returning an object with named properties should be t
364
395
365
396
## Changelog
366
397
367
- ### 1.20.1-SNAPSHOT
398
+ ##### 1.20.1-SNAPSHOT
368
399
369
400
* Documentation improvements
370
401
371
- ### 1.20.0
402
+ ##### 1.20.0
372
403
373
404
* Class FEATURE: addClass()
374
405
* Class FEATURE: Chainable setters
375
406
* Class BUG: domPath() must be external since clone doesn't rebuild self-references.
376
407
* Class BUG: setAttribute() failed when no previous attributes
377
408
378
- ### 1.19.1
409
+ ##### 1.19.1
379
410
380
411
* Deepmerge is a runtime dependancy.
381
412
382
- ### 1.19.0
413
+ ##### 1.19.0
383
414
384
415
* Class syntax (semantic, path, style, build, clone, content, render)
385
416
* Remove useless space in html style attribute after property colon.
386
417
* BUG: src/obj.es and src/svg.es wasn't transpiled in gradle.build.
387
418
388
- ### 1.18.0
419
+ ##### 1.18.0
389
420
390
421
* SVG elements
391
422
* Handle SVG´s case sensitive viewBox attribute
392
423
393
- ### 1.17.1
424
+ ##### 1.17.1
394
425
395
426
* Recursive modifyStyleAndMediaToClassAndCss()
396
427
397
- ### 1.17.0
428
+ ##### 1.17.0
398
429
399
430
* modifyStyleAndMediaToClassAndCss()
400
431
401
- ### 1.16.0
432
+ ##### 1.16.0
402
433
403
434
* Function to object syntax.
404
435
405
- ### 1.15.0
436
+ ##### 1.15.0
406
437
407
438
* Obj
408
439
409
- ### 1.14.0
440
+ ##### 1.14.0
410
441
411
442
* cdata function (https://www.w3.org/TR/REC-xml/#dt-chardata )
412
443
413
- ### 1.13.0
444
+ ##### 1.13.0
414
445
415
446
* Default units in style attribute when using index.es
416
447
* Deprecated objectToCssDeclarations in favour of objToStyleAttr
417
448
* Profiling led to sortedUniqStr
418
449
419
- ### 1.12.1
450
+ ##### 1.12.1
420
451
421
452
* Fix #9 Css order
422
453
423
- ### 1.12.0
454
+ ##### 1.12.0
424
455
425
456
* Limited support for nested selectors (&: hover div)
426
457
* Apply default units to css property values using jss-default-unit.
427
458
428
- ### 1.11.0
459
+ ##### 1.11.0
429
460
430
461
* You can now pass a function as content. Or an array of functions++.
431
462
432
- ### 1.10.0
463
+ ##### 1.10.0
433
464
434
465
* html, head and body accessible as property on any node
435
466
436
- ### 1.9.0
467
+ ##### 1.9.0
437
468
438
469
* Parent and root
439
470
440
- ### 1.8.0
471
+ ##### 1.8.0
441
472
442
473
* Path -- Makes it possible to access and manipulate the DOM.
443
474
* Node.add() -- Makes it possible to manipulate the DOM.
444
475
445
- ### 1.7.0
476
+ ##### 1.7.0
446
477
447
478
* Nested pseudo styling
448
479
* Comment out autoprefixer as it introduced many problems.
449
480
450
- ### 1.6.0
481
+ ##### 1.6.0
451
482
452
483
* Autoprefixer
453
484
454
- ### 1.5.0
485
+ ##### 1.5.0
455
486
456
487
* Generate CSS from style too, so !important can be avoided.
457
488
* Some Dom fixes
458
489
459
- ### 1.4.0
490
+ ##### 1.4.0
460
491
461
492
* Dom
462
493
463
- ### 1.3.0
494
+ ##### 1.3.0
464
495
465
496
* Non Cascading Scaleable Styling
466
497
467
- ### 1.2.0
498
+ ##### 1.2.0
468
499
469
500
* Dasherize attribute names.
470
501
471
- ### 1.1.0
502
+ ##### 1.1.0
472
503
473
504
* Style attribute from object. Keep property order. Dasherize property keys.
474
505
475
- ### 1.0.0
506
+ ##### 1.0.0
476
507
477
508
* Javascript 1.6 Example
478
509
479
- ### 0.0.4
510
+ ##### 0.0.4
480
511
481
512
* Input types.
482
513
* Icon.
483
514
* Use as Enonic XP lib too.
484
515
485
- ### 0.0.3
516
+ ##### 0.0.3
486
517
487
518
* Void elements.
488
519
489
- ### 0.0.2
520
+ ##### 0.0.2
490
521
491
522
* Handle javascript types in attribute values.
492
523
493
- ### 0.0.1
524
+ ##### 0.0.1
494
525
495
526
* Basic functionality. KISS!
496
-
497
- ## Ideas
498
-
499
- * Implement indentation?
500
- * Implement minifying?
0 commit comments