-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add possibility to add additional meta info
refactor: server injectors feat: add head, bodyPrepend, bodyAppend injectors refactor: create browserbuild through rollup replace (not separate entry)
- Loading branch information
Showing
27 changed files
with
378 additions
and
376 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
<!doctype html> | ||
<html {{ htmlAttrs.text(true) }}> | ||
<head {{ headAttrs.text() }}> | ||
{{ title.text() }} | ||
{{ meta.text() }} | ||
{{ head(true) }} | ||
<link rel="stylesheet" href="/global.css"> | ||
{{ link.text() }} | ||
{{ style.text() }} | ||
{{ script.text() }} | ||
{{ noscript.text() }} | ||
</head> | ||
<body {{ bodyAttrs.text() }}> | ||
{{ script.text({ pbody: true }) }} | ||
{{ noscript.text({ pbody: true }) }} | ||
{{ bodyPrepend(true) }} | ||
|
||
<a href="/">← Examples index</a> | ||
{{ app }} | ||
|
||
<script src="/__build__/ssr.js"></script> | ||
{{ script.text({ body: true }) }} | ||
{{ noscript.text({ body: true }) }} | ||
{{ bodyAppend(true) }} | ||
</body> | ||
</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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,49 @@ | ||
import { clientSequences } from '../shared/escaping' | ||
import { showWarningNotSupported } from '../shared/log' | ||
import { getComponentMetaInfo } from '../shared/getComponentOption' | ||
import { getAppsMetaInfo, clearAppsMetaInfo } from '../shared/additional-app' | ||
import getMetaInfo from '../shared/getMetaInfo' | ||
import { isFunction } from '../utils/is-type' | ||
import updateClientMetaInfo from './updateClientMetaInfo' | ||
|
||
export default function refresh (options = {}) { | ||
/** | ||
* When called, will update the current meta info with new meta info. | ||
* Useful when updating meta info as the result of an asynchronous | ||
* action that resolves after the initial render takes place. | ||
* | ||
* Credit to [Sébastien Chopin](https://github.com/Atinux) for the suggestion | ||
* to implement this method. | ||
* | ||
* @return {Object} - new meta info | ||
*/ | ||
/** | ||
* When called, will update the current meta info with new meta info. | ||
* Useful when updating meta info as the result of an asynchronous | ||
* action that resolves after the initial render takes place. | ||
* | ||
* Credit to [Sébastien Chopin](https://github.com/Atinux) for the suggestion | ||
* to implement this method. | ||
* | ||
* @return {Object} - new meta info | ||
*/ | ||
export default function refresh (vm, options = {}) { | ||
// make sure vue-meta was initiated | ||
if (!vm.$root._vueMeta) { | ||
showWarningNotSupported() | ||
return {} | ||
} | ||
|
||
// collect & aggregate all metaInfo $options | ||
const rawInfo = getComponentMetaInfo(options, this.$root) | ||
const rawInfo = getComponentMetaInfo(options, vm.$root) | ||
|
||
const metaInfo = getMetaInfo(options, rawInfo, clientSequences, this.$root) | ||
const metaInfo = getMetaInfo(options, rawInfo, clientSequences, vm.$root) | ||
|
||
const appId = this.$root._vueMeta.appId | ||
const { appId } = vm.$root._vueMeta | ||
const tags = updateClientMetaInfo(appId, options, metaInfo) | ||
|
||
// emit "event" with new info | ||
if (tags && isFunction(metaInfo.changed)) { | ||
metaInfo.changed(metaInfo, tags.addedTags, tags.removedTags) | ||
} | ||
|
||
return { vm: this, metaInfo, tags } | ||
const appsMetaInfo = getAppsMetaInfo() | ||
if (appsMetaInfo) { | ||
for (const additionalAppId in appsMetaInfo) { | ||
updateClientMetaInfo(additionalAppId, options, appsMetaInfo[additionalAppId]) | ||
delete appsMetaInfo[additionalAppId] | ||
} | ||
clearAppsMetaInfo(true) | ||
} | ||
|
||
return { vm, metaInfo, tags } | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.