Open lougreenwood opened 6 years ago
Assuming that /dist
is your default output path for the ember build you would specify /config.json
as the filename - this plugin is appending content to the default output tree.
Hi, thanks for the speedy reply - however, still no luck.
ember v
ember-cli: 3.1.4
node: 10.0.0
os: darwin x64
Here's my ember-cli-build.js
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const PostCssSass = require('@csstools/postcss-sass');
const CssNext = require('postcss-cssnext');
const DiscardComments = require('postcss-discard-comments');
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
// Fixes issue where `{{component "fa-icon"}}` would not work.
'ember-font-awesome': {
includeComponent: true
},
postcssOptions: {
compile: {
extension: 'scss',
enabled: true,
parser: require('postcss-scss'),
plugins: [
{
module: PostCssSass,
options: {
includePaths: [
'app/styles',
'node_modules/font-awesome/scss'
]
}
}
]
},
filter: {
enabled: true,
plugins: [
{
module: CssNext,
options: {
features: {
customProperties: false
}
}
},{
module: DiscardComments
}
]
}
},
fileCreator: [
{
filename: '/config.json',
content: 'hello',
}
],
});
return app.toTree();
};
@lougreenwood - in retrospect I should have named this module-creator
- there is no output file on the filesystem - it gets folded into the appropriate broccoli tree and is available within the app via a require/import.
I did notice that the tree that gets created has no handler for a .json
extension - e.g. the app tree for ember-cli doesn't process .json file into the output app.js
with the following spec
let app = new EmberApp(defaults, {
fileCreator: [
{
filename: '/config.js',
content: 'export default { version: "0.0.0", foobar: "foobaz" }',
}
],
in the generated app.js
file we see
define("foo/config", ["exports"], function (exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = { version: "0.0.0", foobar: "foobaz" //# sourceMappingURL=config.map
};
});
It may be possible by specifying the tree to get a .json
file created - I have not used the plugin in this way.
You can look @ https://github.com/rwjblue/broccoli-file-creator for a more explicit file creation which may better meet your needs
Hi,
I'm trying to use this package, but I'm not making any progress.
It seems that the docs are outdated (
npm install
instead ofember install
,EmberApp.init({});
) - which is making figuring out how to use this add-on quite difficult (is this even an ember-cli pipeline add-on or simply an Ember add-on with cli in the name).Essentially, I'm just trying to create a file in
/dist
directory after I runember b prod
. I'e added the following to myember-cli-build.js
, but after building ember, I don't see the file anywhere...Thanks in advance :)