description and source-codeincluded = function (app, parentAddon) {
// Quick fix for add-on nesting
// https://github.com/ember-cli/ember-cli/issues/3718
// https://github.com/aexmachina/ember-cli-sass/blob/v5.3.0/index.js#L73-L75
if (typeof app.import !== 'function' && app.app) {
this.app = app = app.app;
}
// https://github.com/ember-cli/ember-cli/issues/3718#issuecomment-88122543
this._super.included.call(this, app);
// Per the ember-cli documentation
// http://ember-cli.com/extending/#broccoli-build-options-for-in-repo-addons
var target = (parentAddon || app);
target.options = target.options || {}; // Ensures options exists for Scss/Less below
var options = target.options.emberCliFontAwesome || {};
var faPath = path.join(target.bowerDirectory, 'font-awesome');
var scssPath = path.join(faPath, 'scss');
var lessPath = path.join(faPath, 'less');
var cssPath = path.join(faPath, 'css');
var fontsPath = path.join(faPath, 'fonts');
// Ensure the font-awesome path is added to the ember-cli-sass addon options
// (Taking a cue from the Babel options above)
if (options.useScss) {
target.options.sassOptions = target.options.sassOptions || {};
target.options.sassOptions.includePaths = target.options.sassOptions.includePaths || [];
if (target.options.sassOptions.includePaths.indexOf(scssPath) === -1) {
target.options.sassOptions.includePaths.push(scssPath);
}
}
// Ensure the font-awesome path is added to the ember-cli-less addon options
// (Taking a cue from the Babel options above)
if (options.useLess) {
target.options.lessOptions = target.options.lessOptions || {};
target.options.lessOptions.paths = target.options.lessOptions.paths || [];
if (target.options.lessOptions.paths.indexOf(lessPath) === -1) {
target.options.lessOptions.paths.push(lessPath);
}
}
// Make sure font-awesome is available
if (!fs.existsSync(faPath)) {
throw new Error(
this.name + ': font-awesome is not available from bower (' + faPath + '), ' +
'install it into your project by running `bower install font-awesome --save`'
);
}
// Early out if no assets should be imported
if ('includeFontAwesomeAssets' in options && !options.includeFontAwesomeAssets) {
return;
}
// Import the css when Sass and Less are NOT used
if (!options.useScss && !options.useLess) {
target.import({
development: path.join(cssPath, 'font-awesome.css'),
production: path.join(cssPath, 'font-awesome.min.css')
});
}
// Import all files in the fonts folder when option not defined or enabled
if (!('includeFontFiles' in options) || options.includeFontFiles) {
fs.readdirSync(fontsPath).forEach(function(fontFilename){
target.import(
path.join(fontsPath, fontFilename),
{ destDir:'/fonts' }
);
});
}
}