Skip to content

Commit

Permalink
Удаляет этап генерации карточек для социальных сетей
Browse files Browse the repository at this point in the history
  • Loading branch information
igsekor committed Jan 8, 2025
1 parent 9ead9d3 commit 466b774
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/product-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ jobs:
run: |
cp .env.example .env
npm run build
- name: Генерация карточек для социальных сетей
run: npx gulp socialCards
- name: Публикация сайта
run: |
cd dist
Expand Down
53 changes: 0 additions & 53 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,59 +123,6 @@ exports.setupContent = gulp.series(cloneContent, makeLinks)

exports.dropContent = () => del(['content', ...contentRepFolders.map((folder) => `src/${folder}`)])

// Social cards

const socialCards = async () => {
const browser = await puppeteer.launch({ headless: 'new' })
const page = await browser.newPage()

return pipeline(
gulp.src('dist/{a11y,css,html,js,tools,recipes}/**/index.sc.html'),
new Transform({
objectMode: true,
async transform(file, encoding, done) {
const imagePath = file.path.replace('index.sc.html', 'images/covers/')
if (!fs.existsSync(imagePath)) {
await fsp.mkdir(imagePath, { recursive: true })
}

await page.goto('file://' + file.path)

await page.evaluate(() => {
const image = document.querySelector('.social-card__image')
if (image) {
image.setAttribute('src', image.src.replace(/.*images\//, 'images/'))
}
})

await page.setViewport({
width: 503,
height: 273,
deviceScaleFactor: 1,
})

await page.screenshot({
path: path.join(imagePath, 'og.png'),
type: 'png',
clip: {
x: 0,
y: 0,
width: 503,
height: 273,
},
})

done()
},
}),
)
.catch(console.error)
.finally(async () => {
await page.close()
await browser.close()
})
}

// Build social cards

exports.socialCards = socialCards

Check failure on line 128 in gulpfile.js

View workflow job for this annotation

GitHub Actions / js

'socialCards' is not defined
Expand Down

0 comments on commit 466b774

Please sign in to comment.