A python based preprocessor for HTML imports.
Simple solution for importing common HTML on multiple pages!
It's the most lightweight option when it comes to final pages for the web. Concactus will actually write the imports to your HTML files. This makes the processed files testable locally and avoids having to deal with any server side requests that can potentially slow down your web pages with unnecessary fetch latency.
This is the same demo that is available for download.
Simply drag the 'concactus' folder into the same directory as your HTML files.
Place your importable HTML fragments in that concactus folder. In this example:
footer.html and navigation.html
Make the script runnable:
chmod 755 concactus.py
By default, concactus will target the HTML files that are in the same directory as the 'concactus' folder. In this example:
ignore.html, index.html, page1.html, and page2.html
To indicate an HTML fragment import, simply use these comments in your HTML files:
(using the navigation.html fragment here as an example)
<!-- @concactus import: navigation.html -->
<!-- @concactus end -->
To execute the import, simply run the python script:
The space between the @concactus comments will then be written over with the code from the HTML fragments:
That's it!
You can access optional settings by editing:
All pathnames are relative to where conactus.ini is located.
inputPath: path to where input HTML files are located
outputPath: path to where processed HTML files should be put
By default, inputPath and outputPath are the same, meaning that concactus will simply overwrite the files in that path (best for organization). Don't worry, when run, concactus will only replace code inside the <!-- @concactus --> comments.
importPath: path to where HTML fragments are located
If you want concactus to ignore certain files within the inputPath while parsing, simply include that filename in the concactus.ini file like so:
filetoignore.html: IGNORE
Thank you for using concactus!