It's been a minute... No longer maintaining this so changing status to public archive...
Add a file into the ember app tree.
This is useful for transforming arbitrary data into a consumable format.
npm install --save-dev ember-cli-file-creator
var package = require('package');
EmberApp.init({
fileCreator: [
{
filename: '/service/build-details.js',
content: 'export default {' + package.version + '}',
}
]
});
will result in
export default {
BUILD_VERSION: '1.2.3'
};
Option | Type | Default value | Use |
---|---|---|---|
filename |
String | (required) | Where to put the file within the tree |
content |
String or function that returns a string | (required) | Content of the file |
tree |
String | "app" |
Name of the tree to put the file into |
app
styles
templates
vendor
test-support
public
See Ember CLI API docs for details.
You can specify a function that must return the content as a string.
EmberApp.init({
fileCreator: [{
filename: '/data/functional.js',
content: function() {
var testData = [1, 2, 3];
return 'export default ' + JSON.stringify(testData) + ';';
}
}
will result in
export default [1, 2, 3];
ember server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.