sheetjs-clone/demos/requirejs
SheetJS 64798fd1f9 version bump 0.13.0: AMD support
- library reshaped to support requirejs / amd without shim
- control comment visibility (fixes #998, h/t @cmuruganmsc)
- fixed README code sample error (fixes #1118 h/t @iahmedani)
2018-06-01 12:32:08 -04:00
..
.gitignore demo refresh [ci skip] 2017-09-24 19:40:09 -04:00
app.js version bump 0.13.0: AMD support 2018-06-01 12:32:08 -04:00
browser.html demo refresh [ci skip] 2017-09-24 19:40:09 -04:00
build.js demo refresh [ci skip] 2017-09-24 19:40:09 -04:00
Makefile demo refresh [ci skip] 2017-09-24 19:40:09 -04:00
optimizer.html demo refresh [ci skip] 2017-09-24 19:40:09 -04:00
README.md version bump 0.13.0: AMD support 2018-06-01 12:32:08 -04:00

RequireJS

The module complies with the AMD define semantics, enabling use in RequireJS out of the box.

The require config should set xlsx path to the appropriate dist file:

	paths: {
		xlsx: "xlsx.full.min"
	},

Once that is set, app code can freely require "xlsx":

require(["xlsx"], function(XLSX) {
	/* use XLSX here */
});

Deployments

browser.html demonstrates a dynamic deployment, using the in-browser config:

<script src="require.js"></script>
<script>
require.config({
	baseUrl: ".",
	name: "app",
	paths: {
		xlsx: "xlsx.full.min"
	}
});
</script>
<script src="app.js"></script>

optimizer.html demonstrates an optimized deployment using build.js config:

/* build config */
({
	baseUrl: ".",
	name: "app",
	paths: {
		xlsx: "xlsx.full.min"
	},
	out: "app-built.js"
})

The optimizer is invoked with:

node r.js -o build.js paths.requireLib=./require include=requireLib

That step creates a file app-built.js that can be included in a page:

<!-- final bundle includes require.js, library and app code -->
<script src="app-built.js"></script>

Analytics