Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mizok committed Apr 4, 2022
1 parent 4871f96 commit 58ae9d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: webpack-template
date:
author: Mizok
version: 0.5.0
version: 0.5.1
tags:
---

Expand Down
8 changes: 5 additions & 3 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'webpack-dev-server'; // dont remove this import, it's for webpack-dev-se
import HtmlWebpackPlugin from 'html-webpack-plugin';
const COMPRESS = false;

const getEntriesByParsingTemplateNames = (templatesFolderName)=>{
const getEntriesByParsingTemplateNames = (templatesFolderName,atRoot = true)=>{
const folderPath = resolve(__dirname, `./src/${templatesFolderName}`);
const entryObj: webpack.EntryObject = {};
const templateRegx = /(.*)(\.)(ejs|html)/g;
Expand All @@ -20,9 +20,12 @@ const getEntriesByParsingTemplateNames = (templatesFolderName)=>{
if (entryName.match(entryRegex)) {
entryName = entryName.replace(entryRegex, `$3`);
}

entryName= atRoot?entryName:`${templatesFolderName}/${entryName}`

let entryPath = resolve(__dirname, `src/ts/${entryName}.ts`);
// entry stylesheet
let entryStyleSheetPath = resolve(__dirname, `./src/scss/${templatesFolderName}/${entryName}.scss`);
let entryStyleSheetPath = resolve(__dirname, `./src/scss/${entryName}.scss`);

entryPath = fs.existsSync(entryPath)?entryPath:undefined;
entryStyleSheetPath = fs.existsSync(entryStyleSheetPath)?entryStyleSheetPath:undefined;
Expand Down Expand Up @@ -96,7 +99,6 @@ const config = (env:any,argv:any):webpack.Configuration=>{
devServer: {
historyApiFallback: true,
open: true,
host:'192.168.100.191',
compress: true,
watchFiles: [
'src/pages/*.html',
Expand Down

0 comments on commit 58ae9d4

Please sign in to comment.