2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-10 06:42:26 +03:00

chore: rename constants to use camelCase for better readability

This commit is contained in:
pimlie
2019-02-11 09:16:51 +01:00
parent ec82e1ef9e
commit b4feec0232
3 changed files with 37 additions and 30 deletions
+13 -7
View File
@@ -4,28 +4,29 @@
// This is the name of the component option that contains all the information that
// gets converted to the various meta tags & attributes for the page.
export const VUE_META_KEY_NAME = 'metaInfo'
export const keyName = 'metaInfo'
// This is the attribute vue-meta augments on elements to know which it should
// This is the attribute vue-meta arguments on elements to know which it should
// manage and which it should ignore.
export const VUE_META_ATTRIBUTE = 'data-vue-meta'
export const attribute = 'data-vue-meta'
// This is the attribute that goes on the `html` tag to inform `vue-meta`
// that the server has already generated the meta tags for the initial render.
export const VUE_META_SERVER_RENDERED_ATTRIBUTE = 'data-vue-meta-server-rendered'
export const ssrAttribute = 'data-vue-meta-server-rendered'
// This is the property that tells vue-meta to overwrite (instead of append)
// an item in a tag list. For example, if you have two `meta` tag list items
// that both have `vmid` of "description", then vue-meta will overwrite the
// shallowest one with the deepest one.
export const VUE_META_TAG_LIST_ID_KEY_NAME = 'vmid'
export const tagIDKeyName = 'vmid'
// This is the key name for possible meta templates
export const VUE_META_TEMPLATE_KEY_NAME = 'template'
export const metaTemplateKeyName = 'template'
// This is the key name for the content-holding property
export const VUE_META_CONTENT_KEY = 'content'
export const contentKeyName = 'content'
// List of metaInfo property keys which are configuration options (and dont generate html)
export const metaInfoOptionKeys = [
'titleChunk',
'titleTemplate',
@@ -34,14 +35,19 @@ export const metaInfoOptionKeys = [
'__dangerouslyDisableSanitizersByTagID'
]
// List of metaInfo property keys which only generates attributes and no tags
export const metaInfoAttributeKeys = [
'htmlAttrs',
'headAttrs',
'bodyAttrs'
]
// HTML elements which dont have a head tag (shortened to our needs)
// see: https://www.w3.org/TR/html52/document-metadata.html
export const tagsWithoutEndTag = ['base', 'meta', 'link']
// HTML elements which can have inner content (shortened to our needs)
export const tagsWithInnerContent = ['noscript', 'script', 'style']
// Attributes which are inserted as childNodes instead of HTMLAttribute
export const tagAttributeAsInnerContent = ['innerHTML', 'cssText']
+12 -11
View File
@@ -2,11 +2,12 @@ import batchUpdate from '../client/batchUpdate'
import $meta from './$meta'
import {
VUE_META_KEY_NAME,
VUE_META_ATTRIBUTE,
VUE_META_SERVER_RENDERED_ATTRIBUTE,
VUE_META_TAG_LIST_ID_KEY_NAME,
VUE_META_TEMPLATE_KEY_NAME, VUE_META_CONTENT_KEY
keyName,
attribute,
ssrAttribute,
tagIDKeyName,
metaTemplateKeyName,
contentKeyName
} from './constants'
// automatic install
@@ -21,12 +22,12 @@ if (typeof window !== 'undefined' && typeof window.Vue !== 'undefined') {
export default function VueMeta(Vue, options = {}) {
// set some default options
const defaultOptions = {
keyName: VUE_META_KEY_NAME,
contentKeyName: VUE_META_CONTENT_KEY,
metaTemplateKeyName: VUE_META_TEMPLATE_KEY_NAME,
attribute: VUE_META_ATTRIBUTE,
ssrAttribute: VUE_META_SERVER_RENDERED_ATTRIBUTE,
tagIDKeyName: VUE_META_TAG_LIST_ID_KEY_NAME
keyName,
contentKeyName,
metaTemplateKeyName,
attribute,
ssrAttribute,
tagIDKeyName
}
// combine options
+12 -12
View File
@@ -3,12 +3,12 @@ import { renderToString } from '@vue/server-test-utils'
import VueMetaPlugin from '../../src'
import {
VUE_META_ATTRIBUTE,
VUE_META_CONTENT_KEY,
VUE_META_KEY_NAME,
VUE_META_SERVER_RENDERED_ATTRIBUTE,
VUE_META_TAG_LIST_ID_KEY_NAME,
VUE_META_TEMPLATE_KEY_NAME
keyName,
attribute,
ssrAttribute,
tagIDKeyName,
metaTemplateKeyName,
contentKeyName
} from '../../src/shared/constants'
export {
@@ -18,12 +18,12 @@ export {
}
export const defaultOptions = {
keyName: VUE_META_KEY_NAME,
attribute: VUE_META_ATTRIBUTE,
ssrAttribute: VUE_META_SERVER_RENDERED_ATTRIBUTE,
metaTemplateKeyName: VUE_META_TEMPLATE_KEY_NAME,
contentKeyName: VUE_META_CONTENT_KEY,
tagIDKeyName: VUE_META_TAG_LIST_ID_KEY_NAME
keyName,
attribute,
ssrAttribute,
tagIDKeyName,
metaTemplateKeyName,
contentKeyName
}
export function getVue() {