Derek Adair
Derek Adair

Reputation: 21935

create a custom JS directory in brunch.io

In brunch.io, the application contains two directories that get compiled. These are controlled in your brunch config file, like so:

javascripts:
  defaultExtension: 'coffee'
  joinTo:
    'javascripts/app.js': /^app/
    'javascripts/vendor.js': /^vendor/

I am wondering if it is possible to create a namespace along side of app.js/vendor.js and if so, how I would do that. I tried adding a directory next to app/vendor called namespace/, which contains the CoffeeScript files i want to compile. as well as adding this to the config file...

'javascripts/namespace.js': /^namespace/
  1. Can this be done?
  2. If so, where am i going wrong?

UPDATE

there is a ./public/namespace/ being created with my namespace.coffee file. it appears this is just not registering w/ the watcher? or...?

Upvotes: 3

Views: 1298

Answers (1)

Paul Miller
Paul Miller

Reputation: 1960

It won't work. Brunch currently only watches top-level app, vendor and test. I think i'll change this in future release.

But you can do this:

joinTo:
  'javascripts/namespace.js': /^app(\/|\\)namespace/  # Only app/ns
  'javascripts/app.js': /^app(\/|\\)(?!namespace)/    # Everything but not app/ns
  'javascripts/vendor.js': /^vendor/

Upvotes: 5

Related Questions