nishax
August 13, 2015, 9:09pm
1
Hey guys,
I’m trying to add this plugin to my meteor project:
https://raw.githubusercontent.com/pa7/nude.js/master/nude.js
I’ve put it into my client/plugins folder and now having the following problem: The function gets executed on start and throws an error (element “body” wasn’t found - it’s logical, because the pages isn’t rendered at execution).
How can I add this plugin correctly to my Meteor project?
Try removing init() and call it yourself
nishax
August 13, 2015, 10:01pm
3
Hey okay,
I’ve added it to a variable and calling it after rendering the template.
But what about jQuery plugins that are not listed on Atmosphere (f.e. https://raw.githubusercontent.com/jaysalvat/jquery.facedetection/master/dist/jquery.facedetection.min.js )? I’ve only found some difficult solutions to add them manually but is there an easy solution to add them?
At this moment, I would add them the following way:
client/plugins/face.js
initFace = function() { ...jquery plugin code ... };
client/templates/layout.js
Template.layout.onRendered(function() { initFace(); } );
But is that a “good” solution?
I’d say yes, but I’m not an advanced programmer. You’ve made this modular, I think.