2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-24 02:10:33 +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 // 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. // 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. // 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` // 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. // 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) // 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 // 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 // that both have `vmid` of "description", then vue-meta will overwrite the
// shallowest one with the deepest one. // 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 // 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 // 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 = [ export const metaInfoOptionKeys = [
'titleChunk', 'titleChunk',
'titleTemplate', 'titleTemplate',
@@ -34,14 +35,19 @@ export const metaInfoOptionKeys = [
'__dangerouslyDisableSanitizersByTagID' '__dangerouslyDisableSanitizersByTagID'
] ]
// List of metaInfo property keys which only generates attributes and no tags
export const metaInfoAttributeKeys = [ export const metaInfoAttributeKeys = [
'htmlAttrs', 'htmlAttrs',
'headAttrs', 'headAttrs',
'bodyAttrs' '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'] export const tagsWithoutEndTag = ['base', 'meta', 'link']
// HTML elements which can have inner content (shortened to our needs)
export const tagsWithInnerContent = ['noscript', 'script', 'style'] export const tagsWithInnerContent = ['noscript', 'script', 'style']
// Attributes which are inserted as childNodes instead of HTMLAttribute
export const tagAttributeAsInnerContent = ['innerHTML', 'cssText'] export const tagAttributeAsInnerContent = ['innerHTML', 'cssText']
+12 -11
View File
@@ -2,11 +2,12 @@ import batchUpdate from '../client/batchUpdate'
import $meta from './$meta' import $meta from './$meta'
import { import {
VUE_META_KEY_NAME, keyName,
VUE_META_ATTRIBUTE, attribute,
VUE_META_SERVER_RENDERED_ATTRIBUTE, ssrAttribute,
VUE_META_TAG_LIST_ID_KEY_NAME, tagIDKeyName,
VUE_META_TEMPLATE_KEY_NAME, VUE_META_CONTENT_KEY metaTemplateKeyName,
contentKeyName
} from './constants' } from './constants'
// automatic install // automatic install
@@ -21,12 +22,12 @@ if (typeof window !== 'undefined' && typeof window.Vue !== 'undefined') {
export default function VueMeta(Vue, options = {}) { export default function VueMeta(Vue, options = {}) {
// set some default options // set some default options
const defaultOptions = { const defaultOptions = {
keyName: VUE_META_KEY_NAME, keyName,
contentKeyName: VUE_META_CONTENT_KEY, contentKeyName,
metaTemplateKeyName: VUE_META_TEMPLATE_KEY_NAME, metaTemplateKeyName,
attribute: VUE_META_ATTRIBUTE, attribute,
ssrAttribute: VUE_META_SERVER_RENDERED_ATTRIBUTE, ssrAttribute,
tagIDKeyName: VUE_META_TAG_LIST_ID_KEY_NAME tagIDKeyName
} }
// combine options // combine options
+12 -12
View File
@@ -3,12 +3,12 @@ import { renderToString } from '@vue/server-test-utils'
import VueMetaPlugin from '../../src' import VueMetaPlugin from '../../src'
import { import {
VUE_META_ATTRIBUTE, keyName,
VUE_META_CONTENT_KEY, attribute,
VUE_META_KEY_NAME, ssrAttribute,
VUE_META_SERVER_RENDERED_ATTRIBUTE, tagIDKeyName,
VUE_META_TAG_LIST_ID_KEY_NAME, metaTemplateKeyName,
VUE_META_TEMPLATE_KEY_NAME contentKeyName
} from '../../src/shared/constants' } from '../../src/shared/constants'
export { export {
@@ -18,12 +18,12 @@ export {
} }
export const defaultOptions = { export const defaultOptions = {
keyName: VUE_META_KEY_NAME, keyName,
attribute: VUE_META_ATTRIBUTE, attribute,
ssrAttribute: VUE_META_SERVER_RENDERED_ATTRIBUTE, ssrAttribute,
metaTemplateKeyName: VUE_META_TEMPLATE_KEY_NAME, tagIDKeyName,
contentKeyName: VUE_META_CONTENT_KEY, metaTemplateKeyName,
tagIDKeyName: VUE_META_TAG_LIST_ID_KEY_NAME contentKeyName
} }
export function getVue() { export function getVue() {