Skip to content

Commit

Permalink
fix: postcss plugin to remove fonts from sap-theming css variables (#750
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jbadan committed Mar 3, 2020
1 parent f25ae64 commit 7219a9b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config/postcss-remove-fonts.js
@@ -0,0 +1,12 @@
const postcss = require('postcss');

module.exports = postcss.plugin('remove font variables', function (opts) {
return function (root) {
root.walkDecls(decl => {
const regex = /--sapFontUrl_([a-zA-Z-_0-9])+/g;
if(decl.prop.match(regex)){
decl.remove();
}
});
}
});
2 changes: 2 additions & 0 deletions config/postcss.config.js
Expand Up @@ -6,6 +6,7 @@ const postcssBanner = require('postcss-banner');
const postcssAddFallback = require('./postcss-add-fallback.js');
const postcssCustomProperties = require('postcss-custom-properties'); //ie11 fallbacks
const postcssImport = require('postcss-import');
const postcssRemoveFonts = require('./postcss-remove-fonts.js');
const packageVersion = require('../package.json').version;
const year = new Date().getFullYear();

Expand Down Expand Up @@ -36,6 +37,7 @@ module.exports = {
postcssCustomProperties({
preserve: true
}),
postcssRemoveFonts(), // remove fonts from @sap-theming/theming-base-content
minify,
postcssBanner({
banner: `Fundamental Library Styles v${packageVersion}
Expand Down
1 change: 1 addition & 0 deletions src/fundamental-styles.scss
@@ -1,5 +1,6 @@
// do not change import order
@import "./root";
@import "./variables";
@import "./settings";
@import "./icon";
@import "./layout";
Expand Down
1 change: 1 addition & 0 deletions src/variables.scss
@@ -0,0 +1 @@
@import '@sap-theming/theming-base-content/content/Base/baseLib/sap_fiori_3/css_variables.css';

0 comments on commit 7219a9b

Please sign in to comment.