SASS无效的CSS

时间:2014-07-31 03:49:20

标签: css sass liferay compass-sass

我试图用罗盘编译一些scss,但我收到了错误

error portal/forms.scss (Line 104: Invalid CSS after " width: ": 
expected expression (e.g. 1px, bold), was "@model_hints_co...")

代码:

.lfr-input-resource {
    width: @model_hints_constants_text_display_width@px;
}

代码来自liferay门户源代码:https://github.com/liferay/liferay-portal/blob/b45e6646b18809abf13ddfb60d1d6566e22a8f8c/portal-web/docroot/html/css/portal/forms.css

我不知道@model_hints_constants_text_display_width@px;是什么。

1 个答案:

答案 0 :(得分:1)

您必须将此变量更改为自定义宽度值。

我已对此进行了调查,我发现liferay具有将此令牌替换为其他值的功能:

        public static String parseStaticTokens(String content) {
                return StringUtil.replace(
                        content,
                        new String[] {
                                "@model_hints_constants_text_display_height@",
                                "@model_hints_constants_text_display_width@",
                                "@model_hints_constants_textarea_display_height@",
                                "@model_hints_constants_textarea_display_width@"
                        },
                        new String[] {
                                ModelHintsConstants.TEXT_DISPLAY_HEIGHT,
                                ModelHintsConstants.TEXT_DISPLAY_WIDTH,
                                ModelHintsConstants.TEXTAREA_DISPLAY_HEIGHT,
                                ModelHintsConstants.TEXTAREA_DISPLAY_WIDTH
                        });
        }

例如,你应该把100px放到宽度上:

.lfr-input-resource {
  width: 100px;
}

希望它有所帮助。

问候。