2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-15 02:02:24 +03:00

chore: remove old files after merge

This commit is contained in:
pimlie
2019-04-20 12:53:48 +02:00
parent 8ad6adedc9
commit c7913511fc
2 changed files with 0 additions and 77 deletions
-59
View File
@@ -1,59 +0,0 @@
export default function _tagGenerator (options = {}) {
const { attribute } = options
/**
* Generates meta, base, link, style, script, noscript tags for use on the server
*
* @param {('meta'|'base'|'link'|'style'|'script'|'noscript')} the name of the tag
* @param {(Array<Object>|Object)} tags - an array of tag objects or a single object in case of base
* @return {Object} - the tag generator
*/
return function tagGenerator (type, tags) {
return {
text ({ body = false } = {}) {
// build a string containing all tags of this type
return tags.reduce((tagsStr, tag) => {
if (Object.keys(tag).length === 0) return tagsStr // Bail on empty tag object
if (!!tag.body !== body) return tagsStr
// build a string containing all attributes of this tag
const attrs = Object.keys(tag).reduce((attrsStr, attr) => {
switch (attr) {
// these attributes are treated as children on the tag
case 'innerHTML':
case 'cssText':
case 'once':
return attrsStr
// these form the attribute list for this tag
default:
if ([options.tagIDKeyName, 'body'].indexOf(attr) !== -1) {
return `${attrsStr} data-${attr}="${tag[attr]}"`
}
return typeof tag[attr] === 'undefined'
? `${attrsStr} ${attr}`
: `${attrsStr} ${attr}="${tag[attr]}"`
}
}, '').trim()
// grab child content from one of these attributes, if possible
const content = tag.innerHTML || tag.cssText || ''
// generate tag exactly without any other redundant attribute
const observeTag = tag.once
? ''
: `${attribute}="true" `
// these tags have no end tag
const hasEndTag = ['base', 'meta', 'link'].indexOf(type) === -1
// these tag types will have content inserted
const hasContent = hasEndTag && ['noscript', 'script', 'style'].indexOf(type) > -1
// the final string for this specific tag
return !hasContent
? `${tagsStr}<${type} ${observeTag}${attrs}${hasEndTag ? '/' : ''}>`
: `${tagsStr}<${type} ${observeTag}${attrs}>${content}</${type}>`
}, '')
}
}
}
}
-18
View File
@@ -1,18 +0,0 @@
export default function _titleGenerator (options = {}) {
const { attribute } = options
/**
* Generates title output for the server
*
* @param {'title'} type - the string "title"
* @param {String} data - the title text
* @return {Object} - the title generator
*/
return function titleGenerator (type, data) {
return {
text () {
return String(data).trim() ? `<${type} ${attribute}="true">${data}</${type}>` : ''
}
}
}
}