Skip to content

Commit

Permalink
Include fse design in thumbnail generation
Browse files Browse the repository at this point in the history
add seedlet-theme to json
  • Loading branch information
noahtallen committed Jun 16, 2020
1 parent aa03016 commit d456c3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 12 additions & 4 deletions bin/generate-gutenboarding-design-thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const captureWebsite = require( 'capture-website' );
const sharp = require( 'sharp' );
const wpUrl = require( '@wordpress/url' );
const designs = require( '../client/landing/gutenboarding/available-designs-config.json' );
const fseDesigns = require( '../client/landing/gutenboarding/available-fse-designs-config.json' );

const screenshotsPath = './static/page-templates/design-screenshots'; // Folder to store output images

// image output variables
Expand All @@ -39,20 +41,26 @@ const getDesignUrl = ( design ) => {
} );
};

async function run() {
function getConfigDesigns( config ) {
if (
( typeof designs === 'object' && ! Array.isArray( designs.featured ) ) ||
! designs.featured
) {
console.error(
'Could not find any featured designs. Check the regex or the available-designs.ts file'
);
return;
process.exit( 1 );
}
console.log( `Processing ${ designs.featured.length } designs...` );
return config.featured;
}

async function run() {
const allDesigns = [ ...getConfigDesigns( designs ), ...getConfigDesigns( fseDesigns ) ];

console.log( `Processing ${ allDesigns.length } designs...` );

await Promise.all(
designs.featured.map( async ( design ) => {
allDesigns.map( async ( design ) => {
const url = getDesignUrl( design );
const file = `${ screenshotsPath }/${ design.slug }_${ design.template }_${ design.theme }.jpg`;

Expand Down
4 changes: 4 additions & 0 deletions static/page-templates/page-templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
{
"title": "maywood",
"demo": "https://maywooddemo.wordpress.com/"
},
{
"title": "seedlet-blocks",
"demo": "https://seedletblocksdemo.wordpress.com/"
}
]
}

0 comments on commit d456c3c

Please sign in to comment.