I am writing a custom module to load the crossfilter.js library in Drupal 7. I have followed what I believe are the right steps to doing that when using the Libraries module API. However when I run drush libraries-list all I get for my library is 'not detected'

Below is my sample code. I intend to load version 1.3.7 of the library and already I have a directory called crossfilter and I have the crossfilter.js and crossfilter.min.js files in that directory.

What could I possibly be doing wrong?

function crossfilter_libraries_info() {
$libraries['crossfilter'] = array(
  'name' => 'Crossfilter JS',
  'description' => 'Crossfilter JS integration for Drupal',
  'download url' => 'https://github.com/square/crossfilter/archive/master.zip',
  'vendor url' => 'http://square.github.io/crossfilter/',
  'version arguments' => array(
      'file' => 'crossfilter.min.js',
      'pattern' => '/version="(\d+\.\d+\.\d+)"/',
  'files' => array(
      'js' => array('crossfilter.min.js'),
  'variants' => array(
      'source' => array(
          'files' => array(
              'js' => array('crossfilter.js')

return $libraries;


  • This code looks fine to me. Can you confirm the files are at /sites/libraries/crossfilter/*.js? You could also try to reinstall the module with devel module. Perhaps Drupal has not found the hook yet. Dec 23, 2013 at 12:29
  • Did you mean /sites/all/libraries/crossfilter/*.js? I do have the files in place and still getting the same error. Let me try the devel approach. Dec 23, 2013 at 13:20

1 Answer 1


Most likely your version regex ist wrong. According to the source code, the version string looks like this:

crossfilter.version = "1.3.7";

The regex pattern needs to account for the whitespace around the equal-sign. I'd probably write it like this

'pattern' => '/crossfilter\.version\s*=\s*"(\d+\.\d+\.\d+)"/',
  • That was the gotcha plus the file. I can pick the version from crossfilter.js and not crossfilter.min.js. Dec 30, 2013 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.