Skip to content

Commit

Permalink
Clone wp post
Browse files Browse the repository at this point in the history
  • Loading branch information
leomendoza123 committed May 16, 2024
1 parent 03fb82c commit fabb3a9
Show file tree
Hide file tree
Showing 5 changed files with 1,001 additions and 314 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/clone-post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ jobs:

- name: Run PurgeCSS
run: npm run purgecss

- name: Mix HTML and CSS in a single file
run: npm run grunt
- name: Run Juice
run: npm run juice

- name: Run cloning css script
run: python wordpress-cloning-img-script.py ${{ inputs.environment }} ${{ secrets.WORDPRESS_USERNAME }} ${{ secrets.WORDPRESS_PASSWORD }}
Expand Down
36 changes: 0 additions & 36 deletions gruntfile.js

This file was deleted.

42 changes: 42 additions & 0 deletions inline-css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const juice = require('juice');
const fs = require('fs');

// List of HTML files to be updated
const htmlFiles = [
'dist/index.html',
// 'dist/index-ar.html',
// 'dist/index-cs.html',
// 'dist/index-de.html',
// 'dist/index-es.html',
// 'dist/index-fr.html',
// 'dist/index-it.html',
// 'dist/index-ja.html',
// 'dist/index-ko.html',
// 'dist/index-pl.html',
// 'dist/index-pt.html',
// 'dist/index-ru.html',
// 'dist/index-tr.html',
// 'dist/index-zh-CN.html',
// 'dist/index-zh-TW.html'
];

// Inline CSS for each HTML file
htmlFiles.forEach(htmlFile => {

juice.juiceFile(htmlFile, {}, (err, inlinedHtml) => {
if (err) {
console.error(`Error inlining CSS for file ${htmlFile}: ${err}`);
return;
}


fs.writeFile(htmlFile, inlinedHtml, 'utf8', err => {
if (err) {
console.error(`Error writing file ${htmlFile}: ${err}`);
return;
}
console.log(`CSS inlined successfully for file ${htmlFile}`);
});
});

});
Loading

0 comments on commit fabb3a9

Please sign in to comment.