Skip to content

Commit

Permalink
feat: add modifyDefaultTemplate for plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
yutingzhao1991 committed Jun 28, 2018
1 parent 0ad6e0b commit 8009fc6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/umi-build-dev/src/html/getHTMLContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ export default function(path, service, chunksMap, minifyHTML, isProduction) {
const customizedDocPath = document
? join(paths.cwd, document)
: paths.absPageDocumentPath;
const docPath = existsSync(customizedDocPath)
const existsCustomTpl = existsSync(customizedDocPath);
const docPath = existsCustomTpl
? customizedDocPath
: paths.defaultDocumentPath;
const tpl = readFileSync(docPath, 'utf-8');
let tpl = readFileSync(docPath, 'utf-8');

if (!existsCustomTpl) {
tpl = service.applyPlugins('modifyDefaultTemplate', {
initialValue: tpl,
});
}

if (config.exportStatic && !config.exportStatic.htmlSuffix) {
path = makeSureLastSlash(path);
Expand Down

0 comments on commit 8009fc6

Please sign in to comment.