Skip to content

iliyi/requirejs.bundles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#about requirejs.bundles

A extensions used to set config.bundles for requirejs automatically.

##Introduction

This extensions add a bundles() function to the require object. Pass the deps array to this function, it will automatic set the config.bundles for requirejs, so that the dependence will be load in one request.

##Configuration

It has a config object named .bundleConfig at the require.config() object.

    {
        noBundle : true, // Switch to no bundle mode. default: `false`
        host : baseUrl  // the url concat host. defalut: `baseUrl host`
    }

##Restrictions

  • It works with require.js 2.1.10 or later.
  • Do not used in multiversion contexts RequireJS.

##Example

	define(
    	require.bundles(['jquery','bundle!mods/a, bundle!mods/b', 'bundle!1:mods/c, bundle!1:mods/c']),
    	
    	function($, a, b, c, d){
            // mod a & mod b will be load from a combine url like http://example.com/c/=/mods/a.js,/mods/b.js
            // same as mod c & mod d will be another bundles
    	}
	);

About

a plugin for requires to set bundles automate

Resources

License

Stars

Watchers

Forks

Packages

No packages published