Last active
November 16, 2017 20:40
-
-
Save djedi/87b5dfba50815974061959a22d4ce79a 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> | |
<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="border 1px solid gray"> | |
<pre><code class="language-markup" au-syntax textcontent.bind="code"></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, child} from 'aurelia-framework'; | |
@processContent((compiler, resources, node) => { | |
const originalContent = node.innerHTML; | |
// note the use of single quotes around the data.bind expression | |
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.code = this.hackData.data.trim(); | |
} | |
toggleCodeBlock() { | |
this.visible = !this.visible; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment