Skip to content

Commit

Permalink
start on functionality for replacing iframes in rss
Browse files Browse the repository at this point in the history
  • Loading branch information
uuupah committed Feb 7, 2024
1 parent 0531cbd commit df755da
Show file tree
Hide file tree
Showing 4 changed files with 665 additions and 2 deletions.
18 changes: 17 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// used for minifying code for space saving
const htmlmin = require("html-minifier");
const rimraf = require("rimraf");
const cleancss = require("clean-css");
// used for cleaning /public directory - not needed for github ci
const rimraf = require("rimraf");
// used for rss
const pluginRss = require("@11ty/eleventy-plugin-rss");
// used for rss - reading over html and replacing iframes
const jsdom = require("jsdom");
const { JSDOM } = jsdom;

module.exports = function (eleventyConfig) {
// delete contents of public to ensure removed files are removed from the final build
Expand Down Expand Up @@ -143,6 +149,16 @@ module.exports = function (eleventyConfig) {
return data.eleventyExcludeFromCollections;
}
});

//TODO - use this to replace iframes in rss
eleventyConfig.addFilter("unIframe", function (content) {
const dom = new JSDOM(content);
var iframes = (dom.window.document.getElementsByTagName("iframe"));

for (iframe of iframes) {
console.log(iframe.getAttribute('src'));
}
})

eleventyConfig.on("eleventy.before", ({ runMode }) => {
// Set the environment variable
Expand Down
Loading

0 comments on commit df755da

Please sign in to comment.