0.5.1 • Published 12 years ago
mimosa-require-library-package v0.5.1
mimosa-require-library-package
Overview
Use this module with Mimosa to package library code built using AMD/RequireJS into a single file for use in other applications. This module, when used in tandem with the mimosa-require module will package up several versions of your library for distribution and use outside of your library project.
For more information regarding Mimosa, see http://mimosa.io
Usage
Add 'require-library-package' to your list of modules AFTER the require module. That's all! Mimosa will install the module for you when you start up.
Functionality
By default this module will create three versions of your library.
- One with the Almond AMD shim and a wrapper that allows for exporting your library as a global property to be used in containing apps.
- One for use in other RequireJS applications, but not containing libraries specified in the
removeDependenciesarray - for instance JQuery or Backbone. - One for use in other RequireJS applications but containing all of the dependent libraries and code.
This module executes during a mimosa build when both the --optimize and --package flags are used.
Default Config
libraryPackage:
packaging:
shimmedWithDependencies:true
noShimNoDependencies:true
noShimWithDependencies:true
overrides:
shimmedWithDependencies: {}
noShimNoDependencies: {}
noShimWithDependencies: {}
outFolder: "build"
cleanOutFolder: true
globalName: null
name:null
main:null
mainConfigFile: null
removeDependencies: []packaging- provides three options for packaging your library. By default all are enabled. Each option will deliver the compiled asset to a folder named for the packaging type.packaging.shimmedWithDependencies- when set totruea fully batteries included version of your library is generated. Includes an AMD shim (Almond) and all dependencies.packaging.noShimNoDependencies- when set totruean optimized file is created with shim and dependencies excluded.packaging.noShimWithDependencies- when set totruean optimized file is created without a shim but including dependencies.overrides- Properties passed theoverridesobjects are passed straight to the r.js optimizer for the given packaging type. Any settings inoverrideswill overwrite all other settings, including, for instance, thenameproperty.outFolder- the name of the folder, relative to the root of the project, to place the packaged output.cleanOutFolder- when or not to clean theoutFolderas part of a buildglobalName- Required ifshimmedWithDependenciesis set totrue. The global name of the library for use in non module-managed situations. i.e. "$" or "Backbone"name- Name of library. Ex: "jquery.foo.js". This will be used as the output file name for the optimization. Required.main- The AMD path to the root/entry point of your library.mainConfigFile- A string, the location of the requirejs configuration. Relative to thewatch.compiledDirdirectory. By default, ifrequire.commonConfig(from the mimosa-require module) is used and exists, this is set to that file. IfmainConfigFileis not provided, andrequire.commonConfigdoes not exist, this is set to themainfile.removeDependencies- A list of AMD paths to dependencies to exclude from the library. For instance, "jquery" or "vendor/openlayers". Libraries you expect users of the library to include themselves.