4.10.1 • Published 3 years ago

yyvip-art-template v4.10.1

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

yyvip-art-template

yyvip-art-template is forked from art-template.

support webpack resolveModules

art-template

art-template 是一个渲染性能出众模板引擎,无论在 NodeJS 还是在浏览器中都可以运行。

文档:https://aui.github.io/art-template/

updated

  • update convertFilenameNode, is a function to get reletivePath. lib/precompile.js
function convertFilenameNode() {
  ...
  // if (LOCAL_MODULE.test(relativePath)
  if (LOCAL_MODULE.test(relativePath) || resolvePath === relativePath)
  ...
}
  • update resolveFilename, is a function to resolve path. lib/compile/adapter/resolve-filename.js
function getType(obj) {
  return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
}

function getFilePath(dirs, relativePath, root) {
  var deletedPrefixPath = relativePath.substr(1);
  for (var i = 0; i < dirs.length; i++) {
    var filePath = path.resolve(dirs[i], deletedPrefixPath);
    if (fs.existsSync(filePath)) return filePath;
  }
  return path.resolve(root, deletedPrefixPath);
}

function resolveFilename(filename, options) {
  ...
  } else if (getType(resolveModules) === 'array' && getType(filename) === 'string' && filename[0] === '~') {
    filename = getFilePath(resolveModules, filename, root);
  ...
}

issue

  1. .art file may not in sourceMap if using absolute path like /var/template/test.art