A Pen by Sebastian Rothbucher on CodePen.
This file contains 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
// Step 1: Create a Vue instance | |
const Vue = require('../vue/dist/vue.runtime.common.dev'); | |
const app = require('./vue/app'); | |
// Step 2: Create a renderer | |
const rendererFactory = require('../vue/packages/vue-server-renderer/build.dev'); | |
const renderer=rendererFactory.createRenderer(); | |
// Step 3a: Render the Vue instance to HTML | |
let renderedHtml = null; |
This file contains 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
<div id="rootDiv"> | |
<div v-if="!loaded">Content from Server</div> | |
<test-comp v-if="loaded"></test-comp><!-- do NOT shorthand, vue does swallow the rest of rootDiv then --> | |
<test-bt><button>from Server</button></test-bt> | |
<div v-text="vueText">Text from Server</div> | |
</div> | |
<br /><br /> | |
<button onclick="igniteVue()">Go, vue!</button> (normally on load) |
This file contains 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
<html> | |
<body> | |
<script> | |
function doMagic() { | |
event.preventDefault(); | |
fetch('page2.json').then(res => res.json()).then(res => { | |
Object.keys(res).forEach(k => document.getElementById(k).textContent=res[k]); | |
history.pushState({}, null, "page2.html"); | |
}); | |
} |
This file contains 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
950c950,951 | |
< return $html; | |
--- | |
> $isNoJsOnly = preg_match('/^\\s*$/', $html) || preg_match('/^\\s*</', $html); | |
> return $isNoJsOnly ? '<!-- Start ' . $this->getNameInLayout() .' (' . (property_exists($this, '_template') ? ($this->_template . ' ') : '') . '-->' . $html . '<!-- End ' . $this->getNameInLayout() . ' -->' : $html; |
This file contains 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
// "isomorphic-fetch": "^2.2.1", | |
// "vue": "^2.6.10", | |
// "vue-server-renderer": "^2.6.10" | |
require('isomorphic-fetch'); | |
// Step 1: Create a Vue instance | |
const Vue = require('vue') | |
Vue.component('my-component', { | |
template: `<div>Hello World {{msg}}</div>`, |
This file contains 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
<div> | |
<label><input name="variant" type="radio" value="flexwrap"> Flex wrap</label> | |
<label><input name="variant" type="radio" value="flexwraptwo"> Flex wrap II</label> | |
<label><input type="checkbox" id="checkfake" /> Fake mobile</label> | |
</div> | |
<div id="maindiv"> | |
<div> | |
<table name="caniuse"> | |
<thead> | |
<tr> |
This file contains 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
# losely based on https://gist.github.com/gluc/5f780246d57897b57c6b | |
library(jsonlite) | |
reposLoL <- fromJSON("https://api.github.com/users/hadley/repos", simplifyDataFrame = FALSE) | |
reposDf <- data.frame(name=unlist(sapply(reposLoL, function(x) x$name)), url=unlist(sapply(reposLoL, function(x) x$url))) | |
reposDfAlt <- fromJSON("https://api.github.com/users/hadley/repos", simplifyDataFrame = TRUE) |
This is how you can conver the vuejs guide to a .ePub / Kindle (.mobi) file to read in an eReader (or eReader app):
- Make sure you have Pandoc available (on a Mac, it can be installed by
brew install pandoc
via Homebrew) - Checkout or download master from the Vue docs repo [https://github.com/vuejs/vuejs.org]
- go to
src/v2/guide
- run the following commands in a shell (builds one markdown in order of
order
attr in each file):
echo '' > toc
for i in *.md
do