-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03fb82c
commit fabb3a9
Showing
5 changed files
with
1,001 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.