├── .gitignore
├── www
└── index.html
├── package.json
├── .eleventy.js
└── src
└── index.liquid
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
jsTruthy=false
4 | [BOOL1] condition ok!
5 | [BOOL2] condition ok!
6 | [UNDEF2] condition ok!
7 |
8 | jsTruthy=true
9 | [EMPTY2] condition ok!
10 | [ZERO2] condition ok!
11 | [BOOL1] condition ok!
12 | [BOOL2] condition ok!
13 | [UNDEF2] condition ok!
14 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "11ty-2858",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": ".eleventy.js",
6 | "scripts": {
7 | "build": "eleventy",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "Peter deHaan ",
12 | "license": "MPL-2.0",
13 | "devDependencies": {
14 | "@11ty/eleventy": "^2.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.eleventy.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
3 | * @returns {ReturnType}
4 | */
5 | module.exports = (eleventyConfig) => {
6 | const JS_TRUTHY = false;
7 |
8 | eleventyConfig.addGlobalData("JS_TRUTHY", () => JS_TRUTHY);
9 |
10 | eleventyConfig.setLiquidOptions({
11 | jsTruthy: JS_TRUTHY,
12 | });
13 |
14 | return {
15 | dir: {
16 | input: "src",
17 | output: "www",
18 | },
19 | };
20 | };
21 |
--------------------------------------------------------------------------------
/src/index.liquid:
--------------------------------------------------------------------------------
1 |
2 |
3 | jsTruthy={{ JS_TRUTHY }}
4 |
5 | {%- assign empty = "" %}
6 | {%- assign zero = 0 %}
7 | {%- assign bool = false %}
8 |
9 | {%- if empty == false %}
10 | [EMPTY1] condition ok!
11 | {%- endif %}
12 | {%- if not empty %}
13 | [EMPTY2] condition ok!
14 | {%- endif %}
15 |
16 | {%- if zero == false %}
17 | [ZERO1] condition ok!
18 | {%- endif %}
19 | {%- if not zero %}
20 | [ZERO2] condition ok!
21 | {%- endif %}
22 |
23 | {%- if bool == false %}
24 | [BOOL1] condition ok!
25 | {%- endif %}
26 | {%- if not bool %}
27 | [BOOL2] condition ok!
28 | {%- endif %}
29 |
30 | {%- if undef == false %}
31 | [UNDEF1] condition ok!
32 | {%- endif %}
33 | {%- if not undef %}
34 | [UNDEF2] condition ok!
35 | {%- endif %}
36 |
--------------------------------------------------------------------------------