Skip to content

Instantly share code, notes, and snippets.

@adamstallard
Last active December 21, 2015 20:29
Show Gist options
  • Save adamstallard/6361304 to your computer and use it in GitHub Desktop.
Save adamstallard/6361304 to your computer and use it in GitHub Desktop.
Include a module (using modest-preview.js to preview).
<?xml version='1.0' encoding='UTF-8'?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="modest-preview.js"></script>
<include>lorem</include>
</head>
<body>
<lorem/>
</body>
</html>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur.</p>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
<p class="lorem">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing. Nam quis justo in augue auctor imperdiet. Curabitur aliquet orci sit amet est posuere consectetur.</p>
</body>
</html>
@adamstallard
Copy link
Author

This example should work in a browser, assuming "lorem.xml" and "modest-preview.js" are in the same folder as "include1-pre.xhtml".

If the file is compiled, the output should look like "include1.xhtml". <script src="modest-preview.js"></script> and <include>lorem</include> are removed by the compiler. Since the output is regular xhtml, these are no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment