Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metalsmith-browserify

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-browserify - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

.eslintignore

51

package.json
{
"name": "metalsmith-browserify",
"version": "0.3.0",
"version": "1.0.0",
"description": "Metalsmith plugin to bundle JS with browserify",
"main": "index.js",
"scripts": {
"test": "_mocha index.test.js"
},
"repository": {

@@ -24,18 +20,39 @@ "type": "git",

"homepage": "https://github.com/kopa-app/metalsmith-browserify#readme",
"devDependencies": {
"browserify": "^13.1.1",
"expect.js": "^0.3.1",
"metalsmith": "^2.1.0",
"mocha": "^2.3.4",
"watchify": "^3.8.0"
"main": "lib/index.js",
"scripts": {
"precommit": "lint-staged",
"lint:js": "eslint '**/*.js'",
"lint:prettier": "prettier --list-different '**/*.js'",
"test": "jest",
"test:coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls"
},
"peerDependencies": {
"browserify": "*",
"metalsmith": "*",
"watchify": "*"
"jest": {
"collectCoverageFrom": [
"lib/*.js"
]
},
"greenkeeper": {
"ignore": [
"eslint",
"eslint-plugin-import"
]
},
"dependencies": {
"exorcist": "^0.4.0",
"mkdirp": "^0.5.1"
"debug": "^3.1.0",
"browserify": "^16.1.0"
},
"devDependencies": {
"husky": "^0.14.3",
"coveralls": "^3.0.0",
"assert-dir-equal": "^1.1.0",
"eslint": "^4.18.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.9.0",
"lint-staged": "^7.0.0",
"jest": "^22.4.2",
"metalsmith": "^2.3.0",
"prettier": "^1.10.2",
"rimraf": "^2.6.2"
}
}

@@ -1,48 +0,42 @@

[![Build Status](https://travis-ci.org/kopa-app/metalsmith-browserify.svg)](https://travis-ci.org/kopa-app/metalsmith-browserify)
# metalsmith-browserify
# Metalsmith - Browserify
[![npm version][version-badge]][version-url]
[![build status][build-badge]][build-url]
[![coverage status][coverage-badge]][coverage-url]
[![greenkeeper][greenkeeper-badge]][greenkeeper-url]
[![downloads][downloads-badge]][downloads-url]
Metalsmith plugin to bundle JS with browserify
> A metalsmith plugin to bundle javascript with browserify
This plugin allows you to bundle your javscript with browserify. Pass it the entry points it should bundle, and it will replace those files with the resulting bundle on build.
For support questions please use [stack overflow][stackoverflow-url] or our [slack channel][slack-url]. For browserify specific questions try [their documentation](https://github.com/browserify/browserify).
## Installation
```bash
npm install metalsmith-browserify --save
$ npm install metalsmith-browserify
```
metalsmith-browserify does not bundle browserify. You need to install it yourself in your package.
This is to avoid usage of an outdated browserify version with metalsmith-browserify.
## Options
## Usage
You can pass options to `metalsmith-browserify` with the [Javascript API](https://github.com/segmentio/metalsmith#api) or [CLI](https://github.com/segmentio/metalsmith#cli). The options are:
```javascript
var metalsmith = require('metalsmith');
var browserify = require('metalsmith-browserify');
* [entries](#entries): required. The entry points that need to be browserified. Accepts an array of strings.
* [browserifyOptions](#browserifyoptions): optional. These options will be passed on to browserify. See [this area of the browserify documentation](https://github.com/browserify/browserify#browserifyfiles--opts) for all available options. Note that it's possible to break stuff here, like overriding the entries, so use wisely.
metalsmith(__dirname)
.use(browserify({
dest: 'js/bundle.js',
entries: ['./src/js/index.js'],
sourcemaps: false,
watch: false
}))
.build(function (err, files) {
if (err) {
throw err;
}
});
```
### `entries`
See [browserify api](https://www.npmjs.com/package/browserify#api-example) for available options.
The entry points that should be browserified. So this `metalsmith.json`:
It can also be used with `metalsmith.json` by adding the plugin like this:
```json
{
"source": "src",
"destination": "build",
"plugins": {
"metalsmith-browserify": {
"dest": "javascripts/bundle.js",
"entries": ["src/javascripts/index.js"],
"sourcemaps": false,
"watch": false
"entries": [
"index.js",
"another.js"
]
}

@@ -53,10 +47,44 @@ }

Or assume the defaults (dest: `bundle.js`, args: []):
Would browserify both `./src/index.js` and `./src/another.js` and output them as `./build/index.js` and `./build/another.js` respectively.
### `browserifyOptions`
Use this to pass options to browserify. So this `metalsmith.json`:
```json
{
"source": "src",
"destination": "build",
"plugins": {
"metalsmith-browserify": true
"metalsmith-browserify": {
"entries": ["index.js"],
"browserifyOptions": {
"debug": true
}
}
}
}
```
Would enable browserify's debug option and add a source map to the bundle.
## Errors and debugging
If you're encountering problems you can use [debug](https://www.npmjs.com/package/debug) to enable verbose logging. To enable `debug` prefix your build command with `DEBUG=metalsmith-browserify`. So if you normally run `metalsmith` to build, use `DEBUG=metalsmith-browserify metalsmith` (on windows the syntax is [slightly different](https://www.npmjs.com/package/debug#windows-note)).
## License
MIT
[build-badge]: https://travis-ci.org/kopa-app/metalsmith-browserify.svg?branch=master
[build-url]: https://travis-ci.org/kopa-app/metalsmith-browserify
[downloads-badge]: https://img.shields.io/npm/dm/metalsmith-browserify.svg
[downloads-url]: https://www.npmjs.com/package/metalsmith-browserify
[version-badge]: https://img.shields.io/npm/v/metalsmith-browserify.svg
[version-url]: https://www.npmjs.com/package/metalsmith-browserify
[greenkeeper-badge]: https://badges.greenkeeper.io/kopa-app/metalsmith-browserify.svg
[greenkeeper-url]: https://greenkeeper.io/
[coverage-badge]: https://coveralls.io/repos/github/kopa-app/metalsmith-browserify/badge.svg?branch=master
[coverage-url]: https://coveralls.io/github/kopa-app/metalsmith-browserify?branch=master
[slack-url]: http://metalsmith-slack.herokuapp.com/
[stackoverflow-url]: http://stackoverflow.com/questions/tagged/metalsmith
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc