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.

35 lines
944 B

2 years ago
  1. 'use strict';
  2. const path = require('path');
  3. module.exports = {
  4. init(conf) {
  5. return this.pages(conf);
  6. },
  7. commonParamter() {
  8. let time = new Date();
  9. let version = String(time.getTime() / 1000);
  10. return {
  11. version: version,
  12. };
  13. },
  14. pages(conf) {
  15. console.log('\n');
  16. let entries = conf.getDirJsFile(conf.entryDirectory);
  17. let pages = {};
  18. Object.keys(entries).forEach((entry) => {
  19. console.log(`cretae entry, path:${entry} file:${entry}.html`);
  20. pages[entry] = {};
  21. pages[entry]['entry'] = path.resolve(conf['entryDirectory'], `${entry}.js`);
  22. pages[entry]['template'] = path.resolve(conf['packingTemplatesPath'], 'index.html');
  23. pages[entry]['filename'] = `${entry}.html`;
  24. pages[entry]['title'] = entry;
  25. pages[entry]['paramters'] = this.commonParamter();
  26. pages[entry]['chunks'] = ['chunk-vendors', 'chunk-common', entry];
  27. });
  28. return pages;
  29. }
  30. };