Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

nodebb-plugin-frontend-lodash

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodebb-plugin-frontend-lodash

Easy lodash for NodeBB on client side

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

Easy lodash for NodeBB on client side

Do you use lodash library on client side in your plugins?
I do a lot. And I find it quite troublesome to put the library almost in each and every plugin I make. Furthermore, it rather more troublesome then to require the library in a manner like this:

require(['../../plugins/nodebb-plugin-my-long-plugin-name/public/js/vendor/lodash/lodash.min'], function (_) {
    //
});

Now imagine if you use the lodash library in your plugin a, plugin b and plugin c. All of them will require the library from themself. Since all of the plugins have different base urls, RequireJS will make three different HTTP requests.

Gimme a break!

After installing this plugin you will be able to:

require(['lodash'], function (_) {
    // now you can use the latest "lodash": "^4.0.0"
});

That's it, nothing more, nothing less. I hope it will helps you.

Installation

cd /path/to/nodebb
npm install nodebb-plugin-frontend-lodash

Or via NodeBB Admin panel.

To get this plugin installed automatically along with your plugin, just specify in your plugin.json

"dependencies": {
	"nodebb-plugin-frontend-lodash": "^0"
},
"peerDependencies": {
	"nodebb-plugin-frontend-lodash": "^0"
}

Why both dependencies and peerDependencies? That's because of different behavior in npm v2 and npm v3. You can read more about the issue and the workaround in this blog post

Don't forget to Enable the plugin in the Admin panel after installing. And to instruct your plugin users to do that little extra step!

Information

The plugin:

  • doesn't modify any source of NodeBB
  • gets lodash.min.js from NodeBB node_modules
  • injects lodash directly to RequireJS way before DOM is ready

Keywords

nodebb

FAQs

Package last updated on 03 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts