Add symbolInlineCss configuration option

This commit is contained in:
Mikel Kew 2020-06-26 00:29:50 +10:00
parent 76812f5988
commit 62f346c658
No known key found for this signature in database
GPG Key ID: A81E725FC5835CD1
2 changed files with 8 additions and 8 deletions

View File

@ -233,7 +233,7 @@ function coerce(val) {
} }
if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') { if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']]; var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-symbol-inline-css', 'symbolInlineCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
attrs.forEach(function (_ref) { attrs.forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2), var _ref2 = _slicedToArray(_ref, 2),
attr = _ref2[0], attr = _ref2[0],
@ -252,6 +252,7 @@ var _default = {
replacementClass: DEFAULT_REPLACEMENT_CLASS, replacementClass: DEFAULT_REPLACEMENT_CLASS,
autoReplaceSvg: true, autoReplaceSvg: true,
autoAddCss: true, autoAddCss: true,
symbolInlineCss: true,
autoA11y: true, autoA11y: true,
searchPseudoElements: false, searchPseudoElements: false,
observeMutations: true, observeMutations: true,
@ -897,11 +898,10 @@ function asSymbol (_ref) {
attributes = _ref.attributes, attributes = _ref.attributes,
symbol = _ref.symbol; symbol = _ref.symbol;
var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol; var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol;
var attrs = config.symbolInlineCss === true ? { style: 'display: none;' } : { class: 'svg-symbol--fa' };
return [{ return [{
tag: 'svg', tag: 'svg',
attributes: { attributes: attrs,
class: 'svg-symbol--fa'
},
children: [{ children: [{
tag: 'symbol', tag: 'symbol',
attributes: _objectSpread({}, attributes, { attributes: _objectSpread({}, attributes, {

View File

@ -239,7 +239,7 @@
} }
if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') { if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']]; var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-symbol-inline-css', 'symbolInlineCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
attrs.forEach(function (_ref) { attrs.forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2), var _ref2 = _slicedToArray(_ref, 2),
attr = _ref2[0], attr = _ref2[0],
@ -258,6 +258,7 @@
replacementClass: DEFAULT_REPLACEMENT_CLASS, replacementClass: DEFAULT_REPLACEMENT_CLASS,
autoReplaceSvg: true, autoReplaceSvg: true,
autoAddCss: true, autoAddCss: true,
symbolInlineCss: true,
autoA11y: true, autoA11y: true,
searchPseudoElements: false, searchPseudoElements: false,
observeMutations: true, observeMutations: true,
@ -903,11 +904,10 @@
attributes = _ref.attributes, attributes = _ref.attributes,
symbol = _ref.symbol; symbol = _ref.symbol;
var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol; var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol;
var attrs = config.symbolInlineCss === true ? { style: 'display: none;' } : { class: 'svg-symbol--fa' };
return [{ return [{
tag: 'svg', tag: 'svg',
attributes: { attributes: attrs,
class: 'svg-symbol--fa'
},
children: [{ children: [{
tag: 'symbol', tag: 'symbol',
attributes: _objectSpread({}, attributes, { attributes: _objectSpread({}, attributes, {