Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
debowerify
Advanced tools
A browserify transform to enable the easy use of bower components in browserify client javascript projects. This can be used in conjunction with deamdify to require AMD components from bower as well.
A browserify transform to enable the easy use of bower components in browserify client javascript projects.
This can be used in conjunction with deamdify to require AMD components from bower as well.
Installation is via npm:
$ npm install debowerify
Install some bower components:
# creates files in components/screenfull/
$ bower install screenfull
Require the bower file by it's bower identifier (ie. in this case "screenfull"):
// public/scripts/app.js
var _screenfull = require('screenfull'); // the bower component
var domready = require('domready'); // a regular browserify npm component
domready(function () {
var button = document.getElementById('fullscreen');
button.addEventListener('click', function (evt) {
// screenfull adds itself to window.screenfull - but we can get to it
if (screenfull.enabled) {
screenfull.toggle(this);
}
});
});
Build out your browserify bundle using the debowerify transform:
$ browserify -t debowerify public/scripts/app.js -o public/scripts/build/bundle.js
Then include your bundle.js in your HTML file and you're done!
If your bower components are amd and they don't support commonjs modules than simply use debowerify with the excellent deamdify browserify transform. For example, the following AMD bower import:
# creates files in components/myamdcomponent/
$ bower install myamdcomponent
// public/scripts/amdapp.js
var myamdcomponent = require('myamdcomponent'); // the AMD bower component
var domready = require('domready'); // a regular browserify npm component
domready(function () {
// call the amd component
myamdcomponent.doStuff();
});
To make this all magically work and use the short-form bower name of "amdcomponent" chain both debowerify and deamdify together like this:
$ browserify -t debowerify -t deamdify public/scripts/amdapp.js -o public/scripts/build/bundle.js
Too easy!
The transform depends on the "main" entry in bower.json to be correct.
Some bower components may not have this set, or have it set incorrectly. In this case, either manually update the bower.json file yourself, of just do a require to the relevant full path of the bower javascript file - and then complain to the bower component repo owner! :-)
FAQs
A browserify transform to enable the easy use of bower components in browserify client javascript projects. This can be used in conjunction with deamdify to require AMD components from bower as well.
The npm package debowerify receives a total of 413 weekly downloads. As such, debowerify popularity was classified as not popular.
We found that debowerify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.