![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/dceprojects.corals.io/node_modules/vue/src/server/template-renderer/ |
/* @flow */ const compile = require('lodash.template') const compileOptions = { escape: /{{([^{][\s\S]+?[^}])}}/g, interpolate: /{{{([\s\S]+?)}}}/g } export type ParsedTemplate = { head: (data: any) => string; neck: (data: any) => string; tail: (data: any) => string; }; export function parseTemplate ( template: string, contentPlaceholder?: string = '<!--vue-ssr-outlet-->' ): ParsedTemplate { if (typeof template === 'object') { return template } let i = template.indexOf('</head>') const j = template.indexOf(contentPlaceholder) if (j < 0) { throw new Error(`Content placeholder not found in template.`) } if (i < 0) { i = template.indexOf('<body>') if (i < 0) { i = j } } return { head: compile(template.slice(0, i), compileOptions), neck: compile(template.slice(i, j), compileOptions), tail: compile(template.slice(j + contentPlaceholder.length), compileOptions) } }