Skip to content
This repository was archived by the owner on Mar 9, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ module.exports = {
this.svgSources = app.options.icons.svgSources;
this.iconCSSTemplate = app.options.icons.cssTemplate;
this.iconOutput = app.options.icons.dest;
this.iconFontName = app.options.icons.fontName;
this.iconNoHash = app.options.icons.noHash;
this.includeTemplate = app.options.icons.includeTemplate;

this.iconDestPath = this.iconOutput ?
path.join('assets', this.iconOutput) :
'assets';
}
// Store appRoot so fontcustom can find the icon sources
this.appRoot = app.project.root;
Expand All @@ -18,17 +25,14 @@ module.exports = {
},

contentFor: function(type) {
if (type === 'head') {
return '<link rel="stylesheet" href="assets/icons.css">';
if (type === 'head' && this.includeTemplate !== false) {
return '<link rel="stylesheet" href="' + this.iconDestPath + '/icons.css">';
}
},

// Build font files
// TODO this isn't ideal - icons.css should be included in my SCSS/LESS build
treeForPublic: function(tree) {
var iconDestPath = this.iconDest ?
path.join('assets', this.iconDest) :
'assets';
var svgSources = this.svgSources || path.join('app', 'styles', 'icons');
if (typeof svgSources === 'string') {
svgSources = path.join(this.appRoot, svgSources);
Expand All @@ -38,8 +42,10 @@ module.exports = {
path.join(__dirname, 'addon', 'icons.css');

var fontTree = fontcustom(svgSources, {
output: iconDestPath,
templates: [ templatePath ]
output: this.iconDestPath,
templates: [ templatePath ],
'font-name': this.iconFontName,
'no-hash': this.iconNoHash
});
return mergeTrees([ tree, fontTree ]);
}
Expand Down