html build
This commit is contained in:
parent
eaa07f0cd0
commit
dba6a47c16
|
@ -32,8 +32,8 @@ GIT_CLONE_URL=https://github.com/example/example
|
|||
|
||||
```bash
|
||||
pushd html/
|
||||
npm install
|
||||
./scripts/development
|
||||
npm ci
|
||||
scripts/build
|
||||
popd
|
||||
```
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
rm -rf dist
|
||||
npx webpack --config webpack.production.js -p --colors
|
||||
scripts/copy
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p dist/templates
|
||||
cp src/*.html dist/
|
||||
cp src/templates/*.html dist/templates/
|
|
@ -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() {
|
||||
exec(
|
||||
cmd,
|
||||
{
|
||||
path: process.env.PATH,
|
||||
cwd: process.cwd()
|
||||
},
|
||||
function (err, stdout, stderr) {
|
||||
console.log(stdout);
|
||||
}
|
||||
);
|
||||
async function copy() {
|
||||
return new Promise(function (resolve) {
|
||||
exec(
|
||||
"scripts/copy",
|
||||
{
|
||||
path: process.env.PATH,
|
||||
cwd: process.cwd(),
|
||||
},
|
||||
function (err, stdout, stderr) {
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
rsync();
|
||||
copy();
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"email": "ryan.burnette@gmail.com"
|
||||
}
|
Loading…
Reference in New Issue