Skip to content

Quick helper to include html using js and custom tags

License

Notifications You must be signed in to change notification settings

unicoderns/htmlPartial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

htmlPartial

Quick helper to include html using js and custom tags.

Why?

There's lot of times when you need to code a template and don't want to repeat your code in each file, like the header or footer, then, this helper helps you to test the templates using partials and later pick the template engine that's need it.

Also it works for browser extensions and plugins where performance is not an issue as big as easy maintenance

Usage

  1. Import the js at the end of the html file
  2. Add custom tag:
<partial file="partials/ongoing.html"></partial>

Limitations

Due to Chrome limitation to access iframes of files on the same PC that the js is running (allowed by Firefox), we decide to go with an ajax approach to this, please keep in mind, this means that you need to run the code in an extension or server in order to make it work.

Run server

Due to the limitations you may need to launch an easy fast webserver to test, that's pretty easy, here a couple of options:

Node

  1. Install the library:
sudo npm install http-server -g
  1. Run the server on selected folder:
http-server

Python

  1. Run the server on selected folder:
python -m SimpleHTTPServer

About

Quick helper to include html using js and custom tags

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published