Created
November 16, 2017 18:57
-
-
Save djedi/86c2c4dc64503a530e73f7dd28b8b652 to your computer and use it in GitHub Desktop.
Basic Aurelia Gist Starter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./toggle-code"></require> | |
<toggle-code> | |
<br><hr> | |
</toggle-code> | |
<toggle-code> | |
<foo></foo> | |
<bar></bar> | |
</toggle-code> | |
<toggle-code> | |
blah blah blah | |
</toggle-code> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
<script> | |
require(['aurelia-bootstrapper']); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div style="${visible ? '' : 'display:none'}"> | |
<div style="border 1px solid gray"> | |
<pre><code class="language-markup" au-syntax><slot></slot></code></pre> | |
</div> | |
</div> | |
<button click.trigger="toggleCodeBlock()">${visible ? 'Hide' : 'Show'} Code</button> | |
<br><br> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {processContent, bindable, child} from 'aurelia-framework'; | |
@processContent((compiler, resources, node) => { | |
node.innerHTML = node.innerHTML.escapeHtml(); | |
return true; | |
}) | |
export class toggleCode { | |
attached() { | |
this.visible = true; | |
} | |
toggleCodeBlock() { | |
this.visible = !this.visible; | |
} | |
} | |
(function(){ | |
"use strict"; | |
function escapeHtml() { | |
return this.replace(/[&<>"'\/]/g, function (s) { | |
var entityMap = { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
'"': '"', | |
"'": ''', | |
"/": '/' | |
}; | |
return entityMap[s]; | |
}); | |
} | |
if (typeof(String.prototype.escapeHtml) !== 'function') { | |
String.prototype.escapeHtml = escapeHtml; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment