0.5.4 • Published 8 years ago
browserify-common-prelude v0.5.4
browserify-common-prelude
installation
npm i --save browserify-common-prelude
usage
Better use with factor-bundle (gulp plugin). Best thing of it is that let you add async defer
attributes to script tags and prevent block HTML downloading.
// build.js
// ...
var bcp = fs.readFileSync(require.resolve('browserify-common-prelude/dist/bcp.min.js'), 'utf-8');
browserify({
prelude: bcp
})
.require('jquery')
.require('bluebird')
.bundle()
.pipe(fs.createWriteStream('./global.js'));
browserify({
prelude: bcp
})
.require('chart.js')
.require('moment')
.bundle()
.pipe(fs.createWriteStream('./account.js'));
browserify({
prelude: bcp
})
.add('./a.js')
.external(['jquery', 'bluebird'])
.bundle()
.pipe(fs.createWriteStream('./a.bundle.js'));
browserify({
prelude: bcp
})
.add('./b.js')
.external(['jquery', 'bluebird', 'chart.js', 'moment'])
.bundle()
.pipe(fs.createWriteStream('./b.bundle.js'));
<!doctype html>
<!-- a.html - only one common lib, data-common attribute could be omitted -->
<script src="/global.js" async defer></script>
<script src="/a.bundle.js" async defer></script>
<!doctype html>
<!-- b.html - script tags with data-common attribute must be one after another, no other tags in between -->
<script src="/global.js" data-common async defer></script>
<script src="/account.js" data-common async defer></script>
<script src="/b.bundle.js" async defer></script>
0.5.4
8 years ago
0.5.3
8 years ago
0.5.2
8 years ago
0.5.1
8 years ago
0.5.0
8 years ago
0.4.6
9 years ago
0.4.5
9 years ago
0.4.4
9 years ago
0.4.3
9 years ago
0.4.2
9 years ago
0.4.1
9 years ago
0.4.0
9 years ago
0.3.0
9 years ago
0.3.0-beta3
9 years ago
0.3.0-beta2
9 years ago
0.3.0-beta1
9 years ago
0.2.0
9 years ago
0.2.0-pre3
9 years ago
0.2.0-pre2
9 years ago
0.2.0-pre
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago
0.1.0
9 years ago