mstr-viz
Version:
A new dev tool for creating custom visualizations
27 lines (21 loc) • 969 B
JavaScript
const { getOptions } = require('loader-utils');
module.exports = function iconLoader(source) {
const options = getOptions(this);
// if users set icon styles by themselves, we don't inject them again.
const customized = /#RwMenuModel_WEB-INFxmllayoutsblocksInsertDHTMLWidgetMenuLayoutxml/.test(source);
const tpl = !customized && options.icon ? `\
#RwMenuModel_WEB-INFxmllayoutsblocksInsertDHTMLWidgetMenuLayoutxml #mnuInsertWg${options.name} {
background:url("./images/${options.icon}") no-repeat scroll 4px;
background-size: 16px;
}
#RwMenuModelEditor_WEB-INFxmllayoutsblocksInsertDHTMLWidgetMenuEditorLayoutxml #mnuInsertWg${options.name} {
background:url("./images/${options.icon}") no-repeat scroll 4px;
background-size: 16px;
}
.mstrmojo-VIGallery .mstrmojo-VIGalleryList .item.ic-${options.name} > div > div {
background: url("./images/${options.icon}") no-repeat scroll;
background-size: 30px;
}
` : '';
return `${source}\n${tpl}`;
};