Last active
December 21, 2020 00:49
-
-
Save djedi/207296739baf5ad6948fbfc6167f1ad7 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><hr> | |
</toggle-code> | |
<toggle-code> | |
<table> | |
<thead> | |
<tr> | |
<td>Head 1</td> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td>Cell 1</td> | |
</tr> | |
</tbody> | |
</table> | |
</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> | |
<span style="display: none"><slot></slot></span> | |
<style> | |
pre { | |
background-color: #eee; | |
border: 1px solid #999; | |
padding: 3px 9px; | |
} | |
</style> | |
<div style="${visible ? '' : 'display:none'}"> | |
<div style="${render ? 'display:none' : ''}"> | |
<pre><code class="language-markup" au-syntax textcontent.bind="code"></code></pre> | |
</div> | |
<div style="${render ? '' : 'display:none'}" innerhtml.bind="code"></div> | |
<button click.delegate="renderCode()">Render</button> | |
</div> | |
<button click.delegate="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, child} from 'aurelia-framework'; | |
@processContent((compiler, resources, node) => { | |
const originalContent = node.innerHTML; | |
node.innerHTML = `<hackity-hack style="display:none" data.bind='${JSON.stringify(originalContent)}'></hackity-hack>`; | |
return true; | |
}) | |
export class toggleCode { | |
@child('hackity-hack') hackData; | |
attached() { | |
this.visible = true; | |
this.render = false; | |
this.code = this.hackData.data.trim(); | |
} | |
toggleCodeBlock() { | |
this.visible = !this.visible; | |
} | |
renderCode() { | |
this.render = !this.render; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment