A tiny cross-browser Javascript/CSS file- and module-loader.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
src
tests
.gitignore
.gitmodules
Gruntfile.js
LICENSE
README.md
bower.json
package.json

README.md

minc.js

A tiny cross-browser css, javascript- and module-loader.

minc.js is a lightweight cross-browser Javascript/CSS file- and module-loader. (~800 bytes, minified and gzipped) making it super-easy to dynamically embed your css-files, javascripts and/or initialize custom modules. You simply pass an array with your files to Minc. That's it.
If you load your files via a CDN, you might optionally add another array with fallbacks.

How it's done

Minc(
	[										// load a bunch of files
		'//code.jquery.com/jquery-2.1.0.js',
		'//mycdn.com/my-cool-lib.min.js',
		'//mycdn.com/my-cool-css.min.css'
	],
	[										// optional: set up alternatives, if the CDN is down...
		'lib/jquery-2.1.0.js',
		'src/myCoolApp.min.js',
		'src/my-cool-css.min.css'
	]
).done(function($, myApp) {					// callback, when files are loaded
	// entry point
	$('body').addClass('success');
	myApp.init();
});

Install with bower

$ bower install minc

Cross-browser

minc.js runs in every browser on every device (tested with all devices/browsers at browserstack.com).

Modular JavaScript

minc.js supports the basics of the AMD-structures, thus you might use your own modules.
See an AMD example-module.

If you're not familiar with modular JavaScript, read this.

AMD Issues

If you just want to load AMD-supported libraries without using them inside the module-callback, add an additional empty object as local-context to Minc.

Minc([scripts], [fallbacks], {});