mirror of
https://github.com/veggiemonk/awesome-docker.git
synced 2024-12-21 21:55:22 -05:00
refactor build step
This commit is contained in:
parent
e9d09c35ee
commit
c706acd1fa
40
build.js
40
build.js
@ -6,7 +6,7 @@ const critical = require('critical');
|
|||||||
|
|
||||||
process.env.NODE_ENV = 'production';
|
process.env.NODE_ENV = 'production';
|
||||||
|
|
||||||
const main = () => {
|
const includeReadme = () => {
|
||||||
const converter = new showdown.Converter({
|
const converter = new showdown.Converter({
|
||||||
omitExtraWLInCodeBlocks: true,
|
omitExtraWLInCodeBlocks: true,
|
||||||
simplifiedAutoLink: true,
|
simplifiedAutoLink: true,
|
||||||
@ -38,19 +38,14 @@ const main = () => {
|
|||||||
|
|
||||||
console.log('Writing index.html');
|
console.log('Writing index.html');
|
||||||
fs.writeFileSync('website/index.merged.html', $.html(), 'utf8');
|
fs.writeFileSync('website/index.merged.html', $.html(), 'utf8');
|
||||||
|
return { base: 'website/', src: 'index.merged.html' };
|
||||||
|
};
|
||||||
|
|
||||||
|
const css = ({ base, src }) => {
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('Generating critical css above the fold');
|
console.log('Generating critical css above the fold');
|
||||||
console.log('');
|
console.log('');
|
||||||
|
const dimensions = [
|
||||||
critical
|
|
||||||
.generate({
|
|
||||||
inline: true,
|
|
||||||
base: 'website/',
|
|
||||||
src: 'index.merged.html',
|
|
||||||
dest: 'index.html',
|
|
||||||
css: 'website/style.css',
|
|
||||||
dimensions: [
|
|
||||||
{
|
{
|
||||||
height: 200,
|
height: 200,
|
||||||
width: 500
|
width: 500
|
||||||
@ -59,18 +54,33 @@ const main = () => {
|
|||||||
height: 900,
|
height: 900,
|
||||||
width: 1200
|
width: 1200
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
})
|
const options = {
|
||||||
.then(() => {
|
inline: true,
|
||||||
|
base,
|
||||||
|
src,
|
||||||
|
dest: 'index.html',
|
||||||
|
dimensions
|
||||||
|
};
|
||||||
|
|
||||||
|
return critical.generate(options);
|
||||||
|
};
|
||||||
|
|
||||||
|
const bundle = () => {
|
||||||
|
console.log('');
|
||||||
console.log('Bundling with Parcel.js');
|
console.log('Bundling with Parcel.js');
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
new Parcel('website/index.html', {
|
new Parcel('website/index.html', {
|
||||||
name: 'build',
|
name: 'build',
|
||||||
// publicURL: '/awesome-docker'
|
|
||||||
publicURL: '/'
|
publicURL: '/'
|
||||||
}).bundle();
|
}).bundle();
|
||||||
});
|
};
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const { base, src } = includeReadme();
|
||||||
|
await css({ base, src });
|
||||||
|
bundle();
|
||||||
};
|
};
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<meta HTTP-EQUIV="REFRESH" content="0; url=https://awesome-docker.netlify.com">
|
<meta HTTP-EQUIV="REFRESH" content="0; url=https://awesome-docker.netlify.com">
|
||||||
<title>Awesome-docker</title>
|
<title>Awesome-docker</title>
|
||||||
<!-- <link rel="stylesheet" href="style.css">
|
|
||||||
<link rel="stylesheet" href="critical.css"> -->
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p> <a href="https://awesome-docker.netlify.com/">We moved to a new place, click here to be redirected.</a></p>
|
<p> <a href="https://awesome-docker.netlify.com/">We moved to a new place, click here to be redirected.</a></p>
|
||||||
|
Loading…
Reference in New Issue
Block a user