Skip to content

Instantly share code, notes, and snippets.

@mattcroberts
Last active April 11, 2016 19:01
Show Gist options
  • Save mattcroberts/495475ee547d2a17494c to your computer and use it in GitHub Desktop.
Save mattcroberts/495475ee547d2a17494c to your computer and use it in GitHub Desktop.
Allow multiple index files with ember-cli
var configReplace = require('ember-cli/lib/broccoli/broccoli-config-replace');
var path = require('path');
var funnel = require('broccoli-funnel');
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
fingerprint: {
extensions: ['js', 'css'],
replaceExtensions: ['jsp', 'html']
}
});
app.index = function (){
var files = ['index.html', 'index.jsp'];
var index = funnel('app', {
files: files
});
return configReplace(index, this._configTree(), {
configPath: path.join(this.name, 'config', 'environments', this.env + '.json'),
files: files,
patterns: this._configReplacePatterns()
});
};
module.exports = app.toTree();
@joebartels
Copy link

Thanks for sharing! I'm experimenting with building different index.htmls (one for moible, one for desktop) and found this helpful for testing out the idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment