For a complete overview of this update see https://fthtml.com/changelog/#Onyx
- New Features:
-
Control Flow
-
Added fundamental support for for-each loops
A very high level example of for-each loops:
#vars animals str_split("bear, cat, dog, pig" ", ") #end each @animals { h1 @this }
-
-
Functions
Due to native literal variable support, the following functions have been added to facilitate accessing data
- keys
- values
- sort
- range - lower bound inclusive, upper bound exclusive:
-
- Enhancements
- Native JSON Support
-
You can now reference a json element via typical dot-notation syntax natively and anywhere a regular variable can be referenced. These types of variables (dot-notation) we refer to as 'Literal Variables' because they always return the literal value of what's assigned to it and doesn't get transposed in any way, in almost all cases.
-
range - lower bound inclusive, upper bound exclusive:
-
- Functions
- join can now accept new functions like keys, values etc
- Interpolation
- Added support for piping results into function lambdas
#vars words str_split("The quick brown fox jumped over the lazy dog" " ") #end div "Random word is: ${ @words | capital | choose }
- FTHTMLConfigs
- You can now extend fthtmlconfigs hosted on remote severs. Just enter the http url
- Main index functions are now async due to this addition
- You can now extend fthtmlconfigs hosted on remote severs. Just enter the http url
- Native JSON Support
For a complete overview of this update see https://fthtml.com/changelog/#Heliotrope
- New Features
- Pragmas
- #if-elif-else
- #ifdef
- Functions
- len
- str_split
- join
- Pragmas
- Enhancements
- Tiny Templates
- Extend Attributes
- Placeholder Alternatives
- Functions
- str_format - date formatting support
- JSON
- 'destructoring' via dot-notation
- CLI
- Specify an fthtmlconfig path
- Tiny Templates
- Fixes
- CLI
- extend property now extends from the originating (child) config file, instead of the cwd
- CLI
For a complete overview of this update see https://fthtml.com/changelog/#Smaragdine
- Breaking changes
- Removed the
template
keyword since deprecation.- Templates syntax has changed
- Templates directory (
templateDir
) no longer exists forfthtmlconfig
files - All templates are now handled intuitively by the
import
statement
- Updated escaping sequence rules.
\
are now parsed as is, unless immediately in-front of a string delimiter
- Removed the
- New Features
-
Global Variables
-
Tiny Templates (and global tiny templates)
- Cascade style overwrites
- Templates that are 'tiny' and specifically intended for tag aliases. For example, if you create the same element over and over with the same attributes, let's say, an inline code highlighter:
code(.code-inline data-lang=shell) "> foo bar ./"
You can now make tiny templates that give this a specific element name to call and that converts at runtime:
#tinytemplates shell code(.code-inline data-lang=shell) "${val}" #end html { body { h1 "Hello World" p "To import:" shell "> foo bar ./" p "To export" shell "> foo bar ./ --destination ../out" } }
Which outputs the following html:
<html> <body> <h1>Hello World</h1> <p>To import:</p> <code class="code-inline" data-lang="shell">> foo bar ./</code> <p>To export:</p> <code class="code-inline" data-lang="shell">> foo bar ./ --destination ../out</code> </body> </html>
-
Forced relative imports support
-
ftHTML Blocks for binding properties
-
Native json support
-
Functions
- Added
addslashes
,choose
,html_encode
,html_decode
,random
,replace
,str_repeat
,str_reverse
,str_format
,substring
,tcase
,trim
- Added
-
Macros
- Added
__DATE__
,__DATETIME__
,__ISO_DATE__
,__LOCAL_DATE__
,__LOCAL_DATETIME__
,__NOW__
,__UUID__
,__JS_AGENT__
,__JS_URI__
,___JS_URI_HASH_
,__JS_URI__HOSTNAME_
,__JS_URI_HOST__
,__JS_URI_PORT__
,__JS_URI_PATH__
,__JS_URI_PROTOCOL__
,__JS_URI_SEARCH__
- Added
-
Variables as property binding values are now supported without needing string interpolation
-
- fthtmlconfig
- Added
globalvars
property support - Added
jsonDir
property support - Added
prettify
property support - Added
globaltemplates
property support- supports fthtml syntax
- Added
extend
property support- extend another local fthtmlconfig file
- Added
- This release deprecates the 'template' keyword as it conflicts with a native html tag, preparing for future release.
- Fixed issue where variables would fail in some instances as child elements
- Removed php from supported embedded languages
- Parser redone from ground up
- NOTE: The
+
is now deprecated. It is considered invalid markup. It was optional before, but we found users preferred not to use it anyways. Please adjust accordingly as you upgrade. - Better lexing and parser techniques
- Compile time is now 90% faster! A file using imports (which reads sync) before clocked in at ~100ms to compile, a file with imports now is ~10ms, depending on garbage collection and amount of content of course. Building the ftHTML website with a bunch of imports and templates and over 80 files total now only takes a whopping 103ms
- Changes to errors and error messages
- No changes to syntax but more enforcements for some use cases have been implemented to better support future features (this shouldn't change much but it's best to test your projects before upgrading and rendering with this version)
- NOTE: The
- Moved to typescript!
- This package is now developed with typescript; other than that no additional changes have been made, the vanilla js code you have now will still work. We've even included the js files in the lib so end users aren't required to have typescript installed before installing
- CLI
- Removed useless dependencies ('cli-spinner' was just for show, provided no value)
- Moved away from
node-dir
package to theglob
package because the features are more valuable- You can now use glob patterns for excluding directories
- See here for pattern examples
- NOTE YOU WILL NEED TO UPDATE YOUR EXCLUDED ARRAY if you have saved them with some kind of task or script for building/converting
- You can now use glob patterns for excluding directories
- introducing the
fthtmlconfig.json
file (out of beta)- easily convert a file or directory to html by saving your configurations to a json file
- when this config file is in your project root dir and you configure it to your liking, all you have to do is execute
fthtml convert
from your root dir and that's it!
- Added unit testing
- Small changes to formatting
- Added string interpolation
- Added template binding (very basic template binding)
- Added embedded language tags (js, css)
type language in it's raw syntax
- Better error handling
- Updated attributes values to automatically add double quotes; & convert single to double
- Fixed an issue with keeping tree source flag
- Minor adjustments to fix issues with respective paths for import
- Small fixes
- Simplified errors on parser & lexer for a fthtml language support extension for visual studio code and, in the future, other editors
- Introducing variable functionality
- Use variables to define frequently used styling, links, elements
- You can use a variable anywhere in your ftHTML markup by simply prefixing the variable name with an '@' symbol
- Variables can not hold ftHTML syntax, only as-is string values
- Keywords & Pragmas are now case-sensitive (all lowercase)
- Trivial Adjustments
- Escaped strings support
- Removed the strict rules of file formats (you can now have as many parent elements as you wish)
- Overhauled parsing (made it faster by using less iterations)
- Better parsing error handling
- Removed the rule for an id to be the first attribute in a set, now if there is more than 1 id set an error will be thrown instead. It can be placed randomly as any other attribute
- Ill-formed concatenation now throws errors instead of silently omitting
- Syntax rules are less strict now, for example you can have an empty child (
div {}
) or an empty attribute set (div () {}
)