All Projects β†’ hugabor β†’ bundle-js

hugabor / bundle-js

Licence: MIT license
Bundle your inter-dependent Javascript files in the correct order

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to bundle-js

Gearmanbundle
GearmanBundle for Symfony2
Stars: ✭ 233 (+1009.52%)
Mutual labels:  bundle
parcel-plugin-externals
Parcel plugin for declaring externals. These externals will not be bundled. πŸ“¦
Stars: ✭ 47 (+123.81%)
Mutual labels:  bundle
SlackBundle
SlackBundle for Symfony2 with Guzzle-Integration
Stars: ✭ 39 (+85.71%)
Mutual labels:  bundle
Alpine Vim
"dockerized" Vim
Stars: ✭ 242 (+1052.38%)
Mutual labels:  bundle
SonataTimelineBundle
[Abandoned] Integrates SpyTimelineBundle into Sonata
Stars: ✭ 24 (+14.29%)
Mutual labels:  bundle
LiipSearchBundle
[DEPRECATED] Google XML API for searching is discontinued
Stars: ✭ 35 (+66.67%)
Mutual labels:  bundle
Minipack Explain
explain: <minipack> simple bundle 捆绑器 η€ΊδΎ‹ γ€ŒηΏ»θ―‘γ€β€οΈ ζ ‘ε―Ή βœ…
Stars: ✭ 229 (+990.48%)
Mutual labels:  bundle
gradejs
GradeJS analyzes production Webpack bundles without having access to the source code of a website. Instantly see vulnerabilities, outdated packages, and more just by entering a web application URL.
Stars: ✭ 362 (+1623.81%)
Mutual labels:  bundle
SensioBuzzBundle
No description or website provided.
Stars: ✭ 89 (+323.81%)
Mutual labels:  bundle
rollup-plugin-html-entry
Use HTML files as entry points in your rollup bundle.
Stars: ✭ 13 (-38.1%)
Mutual labels:  bundle
Lexikmaintenancebundle
This Symfony2 bundle allows you to place your website in maintenance mode by calling two commands in your console. A page with status code 503 appears to users, it is possible to authorize certain ips addresses stored in your configuration.
Stars: ✭ 253 (+1104.76%)
Mutual labels:  bundle
gulp-rev-versions-bundle
A bundle that allows symfony to get the version of assets versioned with gulp-rev
Stars: ✭ 13 (-38.1%)
Mutual labels:  bundle
Webpack5-Max
Webpack 5 Boilerplate for JS/React/TS apps.
Stars: ✭ 103 (+390.48%)
Mutual labels:  bundle
Enqueue Bundle
[READ-ONLY] Message queue bundle for Symfony. RabbitMQ, Amazon SQS, Redis, Service bus, Async events, RPC over MQ and a lot more
Stars: ✭ 233 (+1009.52%)
Mutual labels:  bundle
universal-hot-reload
Hot reload client and server webpack bundles for the ultimate development experience
Stars: ✭ 79 (+276.19%)
Mutual labels:  bundle
Fmelfinderbundle
πŸ“ ElFinderBundle provides ElFinder integration with TinyMCE, CKEditor, Summernote editors
Stars: ✭ 231 (+1000%)
Mutual labels:  bundle
grid-bundle
A Symfony2 Ajax Grid
Stars: ✭ 17 (-19.05%)
Mutual labels:  bundle
SonataDashboardBundle
[Abandoned] Provides a Dashboard management through container and block services
Stars: ✭ 17 (-19.05%)
Mutual labels:  bundle
webpack-stats-explorer
Explore your app bundle and compare sizes between builds
Stars: ✭ 23 (+9.52%)
Mutual labels:  bundle
raster-tiles-compactcache
Compact Cache V2 is used by ArcGIS to store raster tiles. The bundle file structure is very simple and optimized for quick access, resulting in improved performance over alternative formats.
Stars: ✭ 49 (+133.33%)
Mutual labels:  bundle

bundle-js

Bundle your inter-dependent Javascript files in the correct order

Install:

npm install -g bundle-js

What It Does

Concatenates your Javascript files.

Just add require comments (// require ./dependecy.js) or (// include ./inc/smallfile.js) to your files and bundle-js will automatically concatenate every file that is needed by every file into one single bundled script.

It uses topological sorting to determine the order in which to concatenate so you don't have to worry about having anything undefined. However, as a result of this, bundle-js does NOT support circular dependencies.

The output is a single JS script that can be written to an output file.

Usage

Within your javascript files you can use comments to indicate what external files are needed by the current file.

  • Using // require ./path/to/file.js ensures that the "required" file comes before the current file in the final concatenated output. Use this when developing multi-file Javascript without any module loaders.
  • Using // include ./path/to/file.js includes the entirety of the file directly at the location of the comment. Useful for including small snippets of code within other code. Note: a file that is require-ed within a file that is include-ed, will still be placed at the top level of the bundled file. See include_b to avoid this behavior.
  • Using // include_b ./path/to/file.js includes the entirety of the file pre-bundled directly at the location of the comment. This is useful for wrapping an entire project in something such as an IIFE or to compile to a specific target such as for the browser or a node module.

Circular dependencies are not allowed (neither for requires or includes).

In order to require or include a file, you must begin the file path with ./, ../, or /. Otherwise, it will search for a node module. This is because file resolution is done using the resolve module, which implements the behavior of Node's require.resolve() (more information here).

Note: These are not case sensitive (ie. you can freely use REQUIRE, INCLUDE, INCLUDE_B)

Options:

  • entry: (required) the "entry point" - a single file path to start finding the dependencies from recursively
  • dest: (optional) the output file path
  • print: (optional) prints the output file to stdout if set to true
  • disable-beautify: (optional) bundle-js by default runs the final output through beautify; set this to true to disable this behavior

Command line:

Usage: bundle-js ./path/to/entryfile.js [-o ./path/to/outputfile] [-p]
       [--disable-beautify]

Options:
  -o, --out, --dest   Output file                                          [default: "./bundlejs/output.js"]
  -p, --print         Print the final bundled output to stdout
  --disable-beautify  Leave the concatenated files as-is (might be ugly!)

Programmatic:

const bundle = require('bundle-js')
let output = bundle({ entry : './index.js' })

Configuration options:

bundle({
    entry : './index.js',
    dest : './bundle.js',
    print : false,
    disablebeautify : false
})

Simple Example

If in file A.js you have

// require ./B.js
console.log(b + ' world!');

and in file B.js

var b = 'Hello';

The final output is going to look like this

var b = 'Hello';
console.log(b + ' world!');

Wrapper Example

In file index.js you have

// require ./dep.js
// some code

in file dep.js

// this is a dependency

Using wrapper1.js

(function() {
    // include ./index.js
})();

Will result in

// this is a dependency
(function() {
    // some code
})();

However, using wrapper2.js

(function() {
    // include_b ./index.js
})();

Will result in

(function() {
    // this is a dependency
    // some code
})();

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].