html build

This commit is contained in:
Ryan Burnette 2020-10-01 11:11:34 -04:00
parent eaa07f0cd0
commit dba6a47c16
5 changed files with 34 additions and 26 deletions

View File

@ -32,8 +32,8 @@ GIT_CLONE_URL=https://github.com/example/example
```bash
pushd html/
npm install
./scripts/development
npm ci
scripts/build
popd
```

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
rm -rf dist
npx webpack --config webpack.production.js -p --colors
scripts/copy

5
html/scripts/copy Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
mkdir -p dist/templates
cp src/*.html dist/
cp src/templates/*.html dist/templates/

View File

@ -1,33 +1,35 @@
#!/usr/bin/env node
'use strict';
"use strict";
var fs = require('fs');
var { exec } = require('child_process');
var fs = require("fs");
var { exec } = require("child_process");
var cmd = `rsync -av --exclude="**.js" --exclude="css/" --exclude="js/" src/ dist/`;
fs.watch(
'src',
"src",
{
recursive: true
recursive: true,
},
function (eventType, filename) {
//console.log(eventType, filename);
if (filename.includes('.html')) {
rsync();
if (filename.includes(".html")) {
copy().then(function () {
console.log("copied html");
});
}
}
);
function rsync() {
async function copy() {
return new Promise(function (resolve) {
exec(
cmd,
"scripts/copy",
{
path: process.env.PATH,
cwd: process.cwd()
cwd: process.cwd(),
},
function (err, stdout, stderr) {
console.log(stdout);
resolve();
}
);
});
}
rsync();
copy();

View File

@ -1,3 +0,0 @@
{
"email": "ryan.burnette@gmail.com"
}