htmlc 1.0.62
See the version list below for details.
dotnet tool install --global htmlc --version 1.0.62
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local htmlc --version 1.0.62
#tool dotnet:?package=htmlc&version=1.0.62
nuke :add-package htmlc --version 1.0.62
html-compiler-tool
This is the HTML Compiler Tool for your cli. htmlc is a small tool with which very easily static HTML files from various HTML components, including layout files and reusable HTML blocks (such as header, footer, etc.) from separate HTML files. The result is written to a complete and finished HTML file. Sass/SCSS compilation is also supported (the path to generated CSS file is then written into the HTML file). In the end you don't have to touch the generated html files.
installation and update
first: install the .NET Runtime
you need to install the .NET Runtime (its free and available for macos, linux and windows)
then: install the tool
then you can install the html-tool very simple via this command:
dotnet tool install --global htmlc
update the tool
dotnet tool update --global htmlc
usage
The compile process searches in the folder for all HTML files. All files that do NOT start with an underscore are compiled. Files with an underscore (for example _layout.html or _footer.html) are used as reusable components.
html files
different html types
entry html
The compiler searches for all HTML files which do NOT start with an underscore (index.html, a-page.html, etc.). files like _layout.html, footer.html, etc. are ignored.
for example:
/src/index.html
<br />
/src/pages.html
<br />
/src/components/buttons.html
<br />
layout
The layout file must start with an underscore. The rest of the naming is up to you. the content consists of reusable layout in HTML (styles and scripts, header, navigation, etc.).
for example:
/src/_layout.html
<br />
reusable components
In addition, you can use other recyclable components. The file name must start with an underscore. The rest of the naming is up to you.
for example:
/src/_navigation.html
<br />
/src/_header.html
<br />
/src/_footer.html
<br />
supported tags and its functionality
@Layout
The @Layout tag is used in an HTML entry file to specify which layout file is to use.
@Body
The @Body tag determines in a layout file where the content from the actual HTML entry file is written.
@File
You can include another file with the @File tag in any HTML file (whether layout file. reusable file or entry file).
@StylePath
htmlc can also compile style files (scss or sass). the path of the compiled CSS file can be inserted using this @StylePath tag. The following usage makes sense:<br />
<link rel="stylesheet" href="@StylePath">
<br />
@Comment
You can generate a HTML comment tag:
HTML Special Chars
You can escape special characters in a section HTML. To do this, place the following tags @StartHtmlSpecialChars and @EndHtmlSpecialChars before and after the block to be escaped:
@StartHtmlSpecialChars
<br />
<h1>a h1 heading</h1>
<br />
@EndHtmlSpecialChars
<br />
turns into
<h1>a h1 heading</h1>
<br />
getting started with your own project
- create a directory with two subdirectories /src and /dist. All project files must be stored under /src. The compiler writes the results under /dist.
- create an initial entry file index.html.
- create a layout file _layout.html.
- write the following basic HTML structure in the _layout.html file.<br />
<html>
<br /><head>
<br /></head>
<br /><body>
<br />@Body
<br /></body>
<br /></html>
<br /> - write the following example in index.html.<br />
@Layout=_layout.html
<br /><section>
<br /><div>Hello again</div>
<br /></section>
<br /> - open the console of your choice and change to the project directory. (/src and /dist must be in it).
- type the following command:<br />
htmlc compile
<br /> - under /dist should now appear a file index.html with the following content:<br />
<html>
<br /><head>
<br /></head>
<br /><body>
<br /><section>
<br /><div>Hello again</div>
<br /></section>
<br /></body>
<br /></html>
<br />
commands
config
With this command, the user configuration, which is located in the user directory as a .htmlc file (e.g. /Users/lk-code/.htmlc), can be edited. The file is hidden per default. all (!) html-files a always blocked, the compiler copies the result to the output-directory.
build-blacklist
With this command, a file type (e.g. *.png) can be blocked for the compilation process so that no files of this type are copied into the output directory during the asset copying process.
htmlc config build-blacklist <add|remove> {fileextensions}
examples:
htmlc config build-blacklist add .png
this command adds a block for all .png-files
htmlc config build-blacklist remove .png
this command removes the entry for .png-files so all png files are copied.
compile
This command compiles all HTML files from the /src (rekusriv) folder and writes the results to /dist.
htmlc compile <project-directory>
If only one path is specified, htmlc searches for /src and /dist in this directory. If these do not exist, then they are created. Then htmlc searches for files in /src and writes the results to the /dist directory. If no path is specified, then htmlc searches for /src and /dist in the current folder.
project-directory (optional): the path to the project directory. for example: /path/to/project
htmlc compile <source-directory> <output-directory>
If two folders are specified, then htmlc uses the first value as the source path and the second value as the output paths.
source-directory (optional): The path to the source directory (equivalent to /src). for example: /path/to/project/src
output-directory (optional): The path to the output directory (equivalent to /dist). for example: /path/to/another/directory/output
htmlc compile [...] [-s --style {path/to/main.scss}]
Optionally, a relative path to the style entry file can be specified with -s or -style. the path to the style file must be specified relative to the /src directory. the relative path to the final css-file is written to the @StylePath-tags.
watch
This command compiles all HTML files from the /src (rekusriv) folder and writes the results to /dist. then /src is observed for changes and recompiled whenever a change is made.
htmlc watch <project-directory>
The watch command is identical to the compile command. The only difference is that the watch command observes the directory after the first compile and restarts the compile process every time a change is made.
project-directory (optional): the path to the project directory. for example: /path/to/project
htmlc watch <source-directory> <output-directory>
If two folders are specified, then htmlc uses the first value as the source path and the second value as the output paths.
source-directory (optional): The path to the source directory (equivalent to /src). for example: /path/to/project/src
output-directory (optional): The path to the output directory (equivalent to /dist). for example: /path/to/another/directory/output
htmlc watch [...] [-s --style {/path/to/main.scss}]
Optionally, a relative path to the style entry file can be specified with -s or -style. the path to the style file must be specified relative to the /src directory. the relative path to the final css-file is written to the @StylePath-tags.
notices
this tool uses:
- Cocona (MIT) for console app environment
- DartSassHost (MIT) for scss compiling
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
1.0.156 | 578 | 12/3/2023 |
1.0.155 | 204 | 11/8/2023 |
1.0.154 | 319 | 11/6/2023 |
1.0.153 | 254 | 11/6/2023 |
1.0.149 | 224 | 10/10/2023 |
1.0.148 | 185 | 10/9/2023 |
1.0.147 | 151 | 10/6/2023 |
1.0.146 | 151 | 10/6/2023 |
1.0.145 | 177 | 10/4/2023 |
1.0.144 | 235 | 9/28/2023 |
1.0.143 | 184 | 9/28/2023 |
1.0.142 | 184 | 9/27/2023 |
1.0.141 | 266 | 9/27/2023 |
1.0.140 | 167 | 9/27/2023 |
1.0.139 | 191 | 9/24/2023 |
1.0.137 | 180 | 9/23/2023 |
1.0.136 | 227 | 9/19/2023 |
1.0.135 | 161 | 9/19/2023 |
1.0.133 | 203 | 9/19/2023 |
1.0.132 | 255 | 9/19/2023 |
1.0.131 | 157 | 9/19/2023 |
1.0.128 | 228 | 9/17/2023 |
1.0.124 | 162 | 9/7/2023 |
1.0.121 | 230 | 9/6/2023 |
1.0.117 | 194 | 8/27/2023 |
1.0.115 | 617 | 8/11/2023 |
1.0.114 | 565 | 8/2/2023 |
1.0.112 | 426 | 7/29/2023 |
1.0.109 | 456 | 7/26/2023 |
1.0.107 | 416 | 7/26/2023 |
1.0.106 | 422 | 7/24/2023 |
1.0.72 | 748 | 2/17/2023 |
1.0.70 | 583 | 2/17/2023 |
1.0.69 | 725 | 2/17/2023 |
1.0.68 | 664 | 2/17/2023 |
1.0.66 | 674 | 2/17/2023 |
1.0.64 | 639 | 2/10/2023 |
1.0.63 | 724 | 1/23/2023 |
1.0.62 | 834 | 1/23/2023 |
1.0.61 | 808 | 1/23/2023 |
1.0.60 | 843 | 1/23/2023 |
1.0.59 | 682 | 1/23/2023 |
1.0.58 | 689 | 1/21/2023 |
1.0.57 | 723 | 1/21/2023 |
1.0.56 | 783 | 1/21/2023 |
1.0.55 | 648 | 1/21/2023 |
1.0.54 | 736 | 1/21/2023 |
1.0.53 | 627 | 1/21/2023 |
1.0.52 | 696 | 1/21/2023 |
1.0.51 | 791 | 1/6/2023 |
1.0.50 | 700 | 1/6/2023 |
1.0.49 | 825 | 1/5/2023 |
1.0.48 | 772 | 1/5/2023 |
1.0.47 | 812 | 1/5/2023 |
1.0.46 | 861 | 1/5/2023 |
1.0.45 | 822 | 1/5/2023 |
1.0.44 | 891 | 1/5/2023 |
1.0.43 | 903 | 1/4/2023 |
1.0.42 | 798 | 1/4/2023 |
1.0.41 | 898 | 1/4/2023 |
1.0.40 | 821 | 1/4/2023 |
1.0.39 | 842 | 1/4/2023 |
1.0.38 | 871 | 1/4/2023 |
1.0.37 | 805 | 1/4/2023 |
1.0.36 | 794 | 1/4/2023 |
1.0.35 | 786 | 1/3/2023 |
1.0.34 | 855 | 1/3/2023 |
1.0.33 | 888 | 1/3/2023 |
1.0.32 | 859 | 1/3/2023 |
1.0.31 | 758 | 1/2/2023 |
1.0.30 | 764 | 1/2/2023 |
1.0.29 | 752 | 1/2/2023 |
1.0.28 | 814 | 1/2/2023 |
1.0.27 | 862 | 1/1/2023 |
1.0.26 | 823 | 1/1/2023 |
1.0.25 | 776 | 1/1/2023 |
1.0.24 | 790 | 1/1/2023 |
1.0.23 | 716 | 1/1/2023 |
1.0.22 | 769 | 1/1/2023 |
1.0.21 | 715 | 1/1/2023 |
1.0.20 | 732 | 1/1/2023 |
1.0.19 | 324 | 12/31/2022 |
1.0.18 | 309 | 12/31/2022 |
1.0.17 | 326 | 12/31/2022 |
1.0.16 | 324 | 12/31/2022 |
1.0.15 | 299 | 12/29/2022 |
1.0.14 | 296 | 12/28/2022 |
1.0.13 | 318 | 12/28/2022 |
1.0.12 | 325 | 12/20/2022 |
1.0.11 | 398 | 11/4/2022 |
1.0.10 | 392 | 11/1/2022 |
1.0.9 | 377 | 11/1/2022 |
1.0.8 | 410 | 10/31/2022 |
1.0.6 | 394 | 8/21/2022 |
1.0.4 | 391 | 8/18/2022 |
1.0.3 | 401 | 8/17/2022 |
1.0.2 | 400 | 8/17/2022 |
1.0.0 | 395 | 8/17/2022 |