Reputation: 1347
I use a config.json
file in my application to configure the application (big surprise) after deployment, pulling them in using the requirejs-text
plugin. Ideally, I would like to keep this JSON file (among others) out of the optimized built file.
Here is my app hierarchy:
app/
data/
config.json
...
scripts/
main.js // require.config in here
controllers/
ctrl.js // Uses JSON files
My current build options (through gulp) for require.js are
{
baseUrl: 'app/scripts',
mainConfigFile: 'app/scripts/main.js',
name: 'main',
out: 'main.js'
}
Since these are just flat files I want to exclude and not modules, is there a way of keeping them out of the final file?
Upvotes: 1
Views: 801
Reputation: 151441
If you list it in the dependencies as 'text!config.json'
, you should be able to exclude it by listing it in exclude
list as 'text!config.json'
. I created a fake project to test it and it worked.
So:
{
baseUrl: 'app/scripts',
mainConfigFile: 'app/scripts/main.js',
name: 'main',
out: 'main.js',
exclude: ['text!config.json']
}
Upvotes: 1