Blame view

node_modules/mpvue-loader/lib/mp-compiler/templates.js 661 Bytes
ce4c83ff   wxy   初始提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  const { getPathPrefix } = require('./util')
  
  function genScript (name, isPage, src) {
    const prefix = isPage ? getPathPrefix(src) : './'
  
    return `
  require('${prefix}static/js/manifest')
  require('${prefix}static/js/vendor')
  require('${prefix}static/js/${name}')
  `
  }
  
  function genStyle (name, isPage, src) {
    const prefix = isPage ? getPathPrefix(src) : './'
    return `@import "${prefix}static/css/${name}.wxss";`
  }
  
  function genPageWxml (templateName, src) {
    return `<import src="${getPathPrefix(src)}components/${templateName}" /><template is="${templateName}" data="{{ ...$root['0'], $root }}"/>`
  }
  
  module.exports = { genScript, genStyle, genPageWxml }