Skip to content
Branch: master
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time



This module will modify d3.js and add a line of code that attaches d3 to the window.


Some d3 projects expect d3 to be on the window. If using AMD/Require.js, d3 does not attach itself to the window. Rather than introducing shims or hacks to attach it, this module tacks window.d3 = d3 at the end of the file. This allows you to continue pulling d3 in via, for instance, bower as the build tool is responsible for performing the update.

Why not just update the code?

If you are using Bower to manage project dependencies, then updating those dependencies is a bad idea because they will just get overwritten. This module does its work after Bower has pulled in dependencies.

For more information regarding Mimosa, see


Add 'd3-on-window' to your list of modules. That's all! Mimosa will install the module for you when you start mimosa watch or mimosa build.


This module will detect the d3.js file and update the code slightly to attach d3 to window. It will detect if it is already attached to the window before updating the code. If it is already attached to window, this module may be unnecessary, so this module will write to the console when it finds it has no work to do with the d3.js file.

Default Config

d3OnWindow: {
  libName: "d3.js",
  replace: /(}\(\);)$/
  • libName: The name of your d3 file.
  • replace: The regex to prepend window.d3 = to in libName


Updates d3 library and adds it to the window object


You can’t perform that action at this time.