智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/5b/5bf39a5ea717a93e02af67a3d55...

22 lines
576 B

const fs = require('fs')
const path = require('path')
const parse = require('./template-transformer/parser')
function getTemplate (content) {
const template = []
const node = parse(content)
node.children.forEach(node => {
if (node.name === 'template') {
const name = node.attribs.name
if (name) {
template.push(name)
}
}
})
return template
}
module.exports = function (filepath, options) {
filepath = path.join(path.dirname(options.filepath), filepath)
return getTemplate(fs.readFileSync(filepath, 'utf8').toString().trim())
}