Skip to content

Commit

Permalink
fix: gh pages workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
steveblue committed Nov 18, 2020
1 parent 748ca34 commit 0fb4d91
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"build": "npm run clean && npm run prod",
"build:lib": "./BUILD.sh",
"build:mock": "rollup -c src/client/rollup.mock.js",
"build:dev": "npm run clean:dist && NODE_ENV=development parcel build src/client/index.html -d dist/client --no-source-maps --no-minify --out-file=index.html",
"build:prod": "concurrently \"npm run prod:client\" \"npm run prod:server\"",
"build:gh-pages": "yarn build:dev && node pages.js",
"copy:root": "copyfiles src/client/robots.txt src/client/static.html src/client/hello.html src/client/hello-state.html src/client/performance.html src/client/custom.html dist/client --flat",
"clean": "yarn clean:dist && yarn clean:packages",
"clean:dist": "rimraf dist",
Expand All @@ -17,7 +19,7 @@
"lint": "eslint src/**/*.ts --fix",
"prod": "NODE_ENV=production npm run clean:dist && npm run build:prod && npm run copy:root && npm run prod:static && npm run build:mock",
"prod:static": "rollup -c src/client/rollup.static.js",
"prod:client": "parcel build src/client/index.html -d dist/client --no-source-maps --out-file=index.html",
"prod:client": "parcel build src/client/index.html -d dist/client --no-source-maps --no-minify --out-file=index.html",
"prod:server": "npm run serve:config && parcel build src/server/index.ts -d dist/server --public-url /dist --target=node --no-source-maps",
"prod:ssr": "NODE_ENV=production rollup -c src/client/rollup.config.js",
"pretty": "prettier \"src/**/*.{js,ts,html,css,scss}\" --write",
Expand Down
44 changes: 20 additions & 24 deletions pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,27 @@ const minifier = require('htmlnano');
const fs = require('fs');
const path = require('path');

const replace = (str) => {
return new Promise((res,rej) => {
try {
str = str.replace(`//# sourceMappingURL=web-animations.min.js.map`, '');
res(str);
}
catch(err) {
rej(err);
}
});
}


const replace = str => {
return new Promise((res, rej) => {
try {
str = str.replace(`//# sourceMappingURL=web-animations.min.js.map`, '');
res(str);
} catch (err) {
rej(err);
}
});
};

(async () => {
const input = await fs.readFileSync('dist/index.html', 'utf8');
const result = posthtml([
inline({ root: path.join(__dirname, 'dist')} )
])
.process(input);
const input = await fs.readFileSync('dist/client/index.html', 'utf8');
const result = posthtml([
inline({ root: path.join(__dirname, 'dist', 'client') })
]).process(input);
const output = await result;
const filtered = await replace(output.html);
fs.writeFile('dist/index-inline.html', filtered, (res, rej) => {
if (rej) {
process.exit();
}
});
})();
fs.writeFile('dist/client/index.html', filtered, (res, rej) => {
if (rej) {
process.exit();
}
});
})();
4 changes: 4 additions & 0 deletions src/client/app/view/home/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ h1 {
font-weight: 700;
}

h2 {
margin-top: 2em;
}

h6 {
font-size: 1em;
}
Expand Down

0 comments on commit 0fb4d91

Please sign in to comment.