I've successfully mapped a JS object (like this) and that's working smoothly.
What I'd now like to do is for the 11ty watch to trigger when that javascript changes.
Conceptual example:
myData.js
module.exports = {
numberOfTweets: somePassedObjectOfTweets.tweetCount
};
Then when somePassedObjectOfTweets changes, I'd like for the 11ty watch to trigger; sort of something like this:
.eleventy.js
Object.observe(somePassedObjectOfTweets, function() {
trigger11tyWatch();
});
Any ideas?
My workaround
For the time being I'm just doing this:
.eleventy.js
const touch = require("touch");
// https://www.npmjs.com/package/touch
Object.observe(somePassedObjectOfTweets, function() {
touch('src/site/_data/myJsDataFile.js');
});