Inspiration

Bringing server-side template technologies such as Apache Tiles or Jade to static web development

What it does

Composite pattern essential means treating a group of objects as if it is composed in one. This is a very common concepts in many areas of coding. . . except static web development. What I propose is a solution to implement this concept in static HTML websites by creating a new kind of file type (.chtml) that will include new syntax to make this possible. With these additions, you are able to add an "include" tag that contains a "file" attribute to point to another .CHTML file you want to replace it with.

Since you can't deply .CHTML to the web, I have construct a web application to analyze the .CHTML content and return back deployable .HTML files.

How is this different from template engines such as Jade or Apache Tiles? Usually these technologies require a framework or library behind it (such as Node.JS or Spring). Using .CHTML requires no external code and can also be used without a back-end.

The value of this concept is that it can make front-end static web development simple, efficient, and more organized thus increasing the productivity and output of web developers.

How I built it

First I created .CHTML templates and created an HTML file of the expected output. Then I created the web application to analyze these files using the Spring MVC framework. The three main tasks for this application was file upload, file analysis, and file download. File upload and file download were somewhat straight-forward. File analysis took a bit of work as I needed to recursively walk through the CHTML includes using a bit of regular expressions.

Challenges I ran into

Accomplishments that I'm proud of

Although I'm satisfied with the final product, I'm mainly proud of the value that this concept can provide to many developers.

What I learned

Learned about file upload, file download, and handling files. Also learned about regular expressions.

What's next for C-HTML Template Engine

To make it W3C recommended :)

Built With

Share this project:

Updates