bower-requirejs icon indicating copy to clipboard operation
bower-requirejs copied to clipboard

Only add to an existing file

Open redolent opened this issue 9 years ago • 1 comments

We have a hand-written require config with a lot of comments. Wanted to know if there is interest in working on a version that doesn't touch the file except minimally.

There's a project someone already started on: https://github.com/xerona/bower-requirejs

redolent avatar Apr 07 '15 20:04 redolent

I had the same problem. Here's the solution I came up with:

  1. Keep the hand-written require config, require.hand-config.js
  2. Create a new require config file just for bower deps. I called it require.bower-paths.js
  3. At build time, concatenate require.hand-config.js and require.bower-paths.js into require.config.js

This works because RequireJS allows require.config({ ... }) to be called multiple times. I've been using this approach for several months and haven't found any downsides yet.

mwcz avatar May 18 '15 18:05 mwcz