https://github.com/khalyomede/fang-browserify
Fang plugin to use browserify.
https://github.com/khalyomede/fang-browserify
browser browserify bundler fang plugin task-runner
Last synced: over 1 year ago
JSON representation
Fang plugin to use browserify.
- Host: GitHub
- URL: https://github.com/khalyomede/fang-browserify
- Owner: khalyomede
- License: mit
- Created: 2019-03-29T23:35:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-30T11:57:06.000Z (over 7 years ago)
- Last Synced: 2025-03-15T03:47:37.616Z (over 1 year ago)
- Topics: browser, browserify, bundler, fang, plugin, task-runner
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@khalyomede/fang-browserify
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fang Browserify
[Fang](https://www.npmjs.com/package/@khalyomede/fang) plugin to use browserify.
   
## Summary
- [Installation](#installation)
- [Usage](#usage)
## Installation
1. Install [fang](https://www.npmjs.com/package/@khalyomede/fang)
```bash
npm install --save-dev @khalyomede/fang@0.*
```
2. Install this package
```bash
npm install --save-dev @khalyomede/fang-browserify@0.*
```
3. Create a script alias
```javascript
// package.json
{
"scripts": {
"fang": "fang"
}
}
```
4. Create a task file (at the root of your folder)
```javascript
// fang.js
const fang = require('@khalyomede/fang');
const browserify = require('@khalyomede/fang-browserify');
const js = () => fang.from('src/js/**/*.js')
.do(browserify())
.save('dist/js');
const build = [js];
module.exports = { build };
```
## Usage
- [Example 1: simple usage](#example-1-simple-usage)
- [Example 2: with options](#example-2-with-options)
### Example 1: simple usage
In this example, we will convert our modules imports into a browser-compatible javascript code.
```javascript
// fang.js
const fang = require('@khalyomede/fang');
const browserify = require('@khalyomede/fang-browserify');
const js = () => fang.from('src/js/**/*.js')
.do(browserify())
.save('dist/js');
const build = [js];
module.exports = { build };
```
### Example 2: with options
In this example, we are using some of the options provided by browserify to customize the behavior of this module.
```javascript
const fang = require('@khalyomede/fang');
const browserify = require('@khalyomede/fang-browserify');
const js = () => fang.from('src/js/**/*.js')
.do(browserify({
debug: true // add a soure map inlined at the end of the file
}))
.save('dist/js');
const build = [js];
module.exports = { build };
```