Git Product home page Git Product logo

htmlx's Introduction

HTMLX Pre-Processor

When designing complex webpages, it becomes important to reuse components and make the pages modular. For e.g. instead of repeating same footer code on all webpages, it makes more sense to write a footer.html file and include it in all your webpages.

On server-side most web frameworks support this using {{include}} statements; however this is not easily available on client side.

HTMLX python based pre-processor that allows you to write HTML files and use dynamic statements like ##include footer.html Which then generates html files in the dist folder without any JS dependencies.

Install Dependencies

pip install watchdog

Usage

Download the HTMLX.py and place it in your project folder

project_folder
|───htmlx.py
|───static   
|   |───dist
|   |   |───index.html
|   |   |───about.html
|   |───index.htmlx
|   |───about.htmlx
|   |───footer.html
|───|
  1. Create a folder called static. Inside this folder create files called index.htmlx about.htmlx footer.html
  2. Open htmlx files in any text editor, and inside body tags include footer.html using ##include footer.html
cd project_folder
python htmlx.py -c static/  -m prod

Options

Arguments

-m (Mode): Debug or Prod mode. In prod mode, it strips out all console.log statements

-w : Watch folder for changes to all .htmlx files and automatically compile to generate results in dist folder

-c : Compile the folder and generate files in dist

htmlx's People

Contributors

krunal-jain avatar mthakkar011 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.