I was recently working on a requirement where I had to create an AEM component automatically with dialogs and clientlibs. More on this later, in a later post. While implementing the requirement, I wanted to use Jquery on grunt for some dom manipulation.
Here is how you do it.
var doc = jsdom(grunt.file.read(//path to html file));
var window = doc.parentWindow;
var $ = require(‘jquery’)(window);
var bodyText = $(“body”).html();
So, simple. I was reading Stackoverflow and came across fs.readFile and fs.readSyncFile which are async and sync functions but they were not simply working and hence i had to use grunt.file.read function.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.