fix(core): update

This commit is contained in:
2020-03-09 14:36:55 +00:00
parent bad5690d99
commit dddd3ead1c
4 changed files with 24 additions and 8 deletions

View File

@ -21,5 +21,21 @@ export const runCli = async () => {
}
});
tsBundleCli.addCommand('element').subscribe(async argvArg => {
const tsbundle = new TsBundle();
// const htmlHandler = new HtmlHandler();
switch (true) {
case argvArg.production || process.env.CI:
await tsbundle.buildProduction('./ts_web/index.ts', './dist_ts_web/bundle.js');
// await htmlHandler.minifyHtml();
break;
case argvArg.test:
default:
await tsbundle.buildTest(argvArg.from, argvArg.to);
// await htmlHandler.copyHtml();
return;
}
});
tsBundleCli.startParse();
};

View File

@ -10,15 +10,15 @@ export class HtmlHandler {
}
// copies the html
public async copyHtml() {
public async copyHtml(targetPathArg = this.targetFilePath) {
if (!(await this.checkIfExists())) {
return;
}
await plugins.smartfile.fs.copy(this.sourceFilePath, this.targetFilePath);
await plugins.smartfile.fs.copy(this.sourceFilePath, targetPathArg);
}
// copies and minifies the html
public async minifyHtml() {
public async minifyHtml(targetPathArg = this.targetFilePath) {
if (!(await this.checkIfExists())) {
return;
}
@ -33,6 +33,6 @@ export class HtmlHandler {
collapseInlineTagWhitespace: true,
removeComments: true
});
plugins.smartfile.memory.toFsSync(minifiedHtml, this.targetFilePath);
plugins.smartfile.memory.toFsSync(minifiedHtml, targetPathArg);
}
}