Thursday, 16 March 2017

HTML Alternative to Jade Template Block Structure - Header/Nav in one file

Currently im creating an admin interface for an embedded automation project (CPP) on a pi3. At the moment node.js and express are applied for the frontend/backend. Because the performance of loading the pages is so poor, i think about to write the frontend view in pure html. A first test was much faster.

However the jade block syntax is very pleasent for my structure: Putting the header with the menu bar in a separate file and outsource the content with blocks in separate files. Till now it was extremly easy to change something in the menu and get the result in each page. The menu bar is build with bootstrap.

How can i use such a structure with a separate header file in pure html? I found one way with Jquery and loading the content from an menu file.

<html>
<script type="text/javascript">
    $(document).ready(function(){
        $('#menu').('navbar.html');
    });
</script>

<body>
    <div id='menu' />
</body>
</html>

Found at How to store nav bar in one file?

Is there a better method or a best practice?

Thank you



via mecheng

No comments:

Post a Comment