Skip to content

Commit

Permalink
Merge pull request #142 from LiangCY/feat/custom-html-template
Browse files Browse the repository at this point in the history
Feat/custom html template
  • Loading branch information
LiangCY authored Aug 3, 2021
2 parents 81c2177 + ad7e6d6 commit 0ca6c4a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pri",
"version": "4.3.10",
"version": "4.3.11",
"types": "src/node/index.ts",
"main": "built/node/index.js",
"scripts": {
Expand Down
20 changes: 11 additions & 9 deletions src/built-in-plugins/command-build/plugin/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ export const buildProject = async (opts: IOpts = {}) => {
outFileName: '[name].js',
publicPath: opts.publicPath, // If unset, use config value.
pipeConfig: async config => {
staticHtmlPaths.forEach(staticHtmlPath => {
config.plugins.push(
new HtmlWebpackPlugin({
title: pri.sourceConfig.title || globalState.projectRootPath.split(path.sep).pop(),
filename: staticHtmlPath,
template: path.join(__dirname, '../../../../template-project.ejs'),
}),
);
});
if (pri.sourceConfig.useHtmlTemplate) {
staticHtmlPaths.forEach(staticHtmlPath => {
config.plugins.push(
new HtmlWebpackPlugin({
title: pri.sourceConfig.title || globalState.projectRootPath.split(path.sep).pop(),
filename: staticHtmlPath,
template: path.join(__dirname, '../../../../template-project.ejs'),
}),
);
});
}
return config;
},
});
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ts-plus-babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const buildSass = (wholeProject: boolean, sourcePath: string) => {
(options, fn) => {
return fn(options);
},
{includePaths: path.join(pri.projectRootPath, 'node_modules')},
{ includePaths: path.join(pri.projectRootPath, 'node_modules') },
),
),
);
Expand All @@ -80,7 +80,7 @@ const buildLess = (wholeProject: boolean, sourcePath: string) => {
(options, fn) => {
return fn(options);
},
{paths: [path.join(pri.projectRootPath, 'node_modules', 'includes')]},
{ paths: [path.join(pri.projectRootPath, 'node_modules', 'includes')] },
),
),
);
Expand Down

0 comments on commit 0ca6c4a

Please sign in to comment.