撇号ui中的CSS错误,解决该错误的最佳方法?

时间:2018-08-08 05:44:42

标签: apostrophe-cms

我正在通过CSS验证程序运行博客,发现开箱即用的某些字体未正确定义,具体来说,这是在apostrophe / lib / modules / apostrophe-ui / public / css /中全局/fonts.less

@apos-ui-font-path: '/modules/apostrophe-ui/fonts/';

.apos-add-font('roboto', @apos-ui-font-path + 'roboto-regular-webfont');
.apos-add-font('roboto', @apos-ui-font-path + 'roboto-light-webfont', normal, 300);
.apos-add-font('roboto', @apos-ui-font-path + 'roboto-bold-webfont', normal, 500);

.apos-add-font('karla', @apos-ui-font-path + 'karla-regular-webfont');
.apos-add-font('karla', @apos-ui-font-path + 'karla-bold-webfont', normal, 700);

使用变量在路径中添加一个空格,并且,在已编译/最小化的css文件中还有一些额外的''。就像下面的行:

src: url(''/modules/apostrophe-ui/fonts/' 'roboto-regular-webfont'.eot');

为了解决此问题,我不得不停止使用路径变量,如下所示:

.apos-add-font('roboto', '/modules/apostrophe-ui/fonts/roboto-regular-webfont');
.apos-add-font('roboto', '/modules/apostrophe-ui/fonts/roboto-light-webfont', normal, 300);
.apos-add-font('roboto', '/modules/apostrophe-ui/fonts/roboto-bold-webfont', normal, 500);

.apos-add-font('karla', '/modules/apostrophe-ui/fonts/karla-regular-webfont');
.apos-add-font('karla', '/modules/apostrophe-ui/fonts/karla-bold-webfont', normal, 700);

此外,将apostrophe-ui文件夹移动到我自己的lib文件夹中会导致CSS重复,因此我在node_modules中的原始文件夹中进行了更改,但这意味着所有更改将在下一个npm更新中被覆盖。是否可以从node_modules中删除该模块以避免重复的CSS代码?

1 个答案:

答案 0 :(得分:0)

嘿,谢谢你提出这个问题。看起来像将字符串变量与另一个字符串连接起来的正确方法看起来像这样https://github.com/apostrophecms/apostrophe/pull/1604/files

新生成的CSS通过了验证程序的一部分:)

这应该是下一发行版的一部分