Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Can't get my addon to render a js file
COOLak
New
I have an addon with the following structure:
A folder bigbrother in plugins directory
bigbrother/addon.json contains this:
{ "type": "addon", "key": "bigbrother", "name": "Big Brother Addon", "description": "Integrative functions to integrate with Bolt's Big Brother Extension", "version": "1.0.0", "mobileFriendly": true, "require": { "vanilla": ">=2.8" }, "authors": [ { "name": "COOLak", "email": "admin@mysite.com", "homepage": "https://www.mysite.com" } ] }
bigbrother/class.bigbrother.php contains this:
<?php class BigBrotherPlugin extends Gdn_Plugin { public function base_render_before($sender) { /** @var Gdn_Controller $sender */ $sender->addJsFile('iframeResizer.contentWindow.min.js', 'plugins/bigbrother'); } }
The error:
The file iframeResizer.contentWindow.min.js resides in bigbrother/js directory. The addon is enabled. And my JS isn't anywhere in the DOM. What's the issue?
0
Comments
It might be the same problem as mentioned in another discussion: your plugin file should to be named either "class.bigbrother.plugin.php" or "BigBrotherPlugin.php"
@R_J
Sorry, I made a typo, it already was named class.bigbrother.plugin.php. Anyway, everything started working after I emptied the cache folder.
It's worth noting that we cache the plugin file location and addon.json contents in the cache directory which is the reason why clearing that folder fixed it.
Realistically you need to clear the cache anytime