mirror of
https://github.com/veggiemonk/awesome-docker.git
synced 2024-12-22 06:05:03 -05:00
refactor build step
This commit is contained in:
parent
e9d09c35ee
commit
c706acd1fa
66
build.js
66
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,39 +38,49 @@ 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 = [
|
||||||
|
{
|
||||||
|
height: 200,
|
||||||
|
width: 500
|
||||||
|
},
|
||||||
|
{
|
||||||
|
height: 900,
|
||||||
|
width: 1200
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const options = {
|
||||||
|
inline: true,
|
||||||
|
base,
|
||||||
|
src,
|
||||||
|
dest: 'index.html',
|
||||||
|
dimensions
|
||||||
|
};
|
||||||
|
|
||||||
critical
|
return critical.generate(options);
|
||||||
.generate({
|
};
|
||||||
inline: true,
|
|
||||||
base: 'website/',
|
|
||||||
src: 'index.merged.html',
|
|
||||||
dest: 'index.html',
|
|
||||||
css: 'website/style.css',
|
|
||||||
dimensions: [
|
|
||||||
{
|
|
||||||
height: 200,
|
|
||||||
width: 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
height: 900,
|
|
||||||
width: 1200
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
console.log('Bundling with Parcel.js');
|
|
||||||
console.log('');
|
|
||||||
|
|
||||||
new Parcel('website/index.html', {
|
const bundle = () => {
|
||||||
name: 'build',
|
console.log('');
|
||||||
// publicURL: '/awesome-docker'
|
console.log('Bundling with Parcel.js');
|
||||||
publicURL: '/'
|
console.log('');
|
||||||
}).bundle();
|
|
||||||
});
|
new Parcel('website/index.html', {
|
||||||
|
name: 'build',
|
||||||
|
publicURL: '/'
|
||||||
|
}).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