Skip to content
Evan Lovely edited this page Feb 13, 2015 · 5 revisions

Share your wiredep configuration to support non-default filetypes.

Drupal Theme Files - @EvanLovely

drupal: {
  block: /(([ \t]*);\s*bower:*(\S*))(\n|\r|.)*?(;\s*endbower)/gi,
  detect: {
    js: /<script.*src=['"]([^'"]+)/gi,
    css: /<link.*href=['"]([^'"]+)/gi
  },
  replace: {
    js: 'scripts[] = {{filePath}}',
    css: 'stylesheets[] = {{filePath}}'
  }
}

HAML Support - @ngottlieb88

If you need to use wiredep to automatically inject Bower components into HAML files (before they are compiled into HTML), the config is pretty similar to Jade (which is usable out of the box):

fileTypes: {
  haml: {
    block: /(([ \t]*)\/\s*bower:*(\S*))(\n|\r|.)*?(\/\s*endbower)/gi,
    detect: {
      js: /%script{.*:src => ['"]([^'"]+)/gi,
      css: /%link{.*:href => ['"]([^'"]+)/gi
    },
    replace: {
      js: '%script{:src => \'{{filePath}}\'}',
      css: '%link{:rel => \'stylesheet\', :href => \'{{filePath}}\'}\/'
    }
  }
}
Clone this wiki locally