有没有办法使用Sass函数的CSS变量,例如减轻?像这样的东西:
:root {
--color: #ff00ff;
}
.div {
background-color: lighten(var(--color), 32%);
}
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息,"论证$color
的lighten($color, $amount)
必须是一种颜色".
我正在使用CSS(而不是Sass)变量,因为我需要在js中使用它们.
我正在我的页面上工作PWA,我正在关注100%这个简单的代码框 - https://codelabs.developers.google.com/codelabs/add-to-home-screen/#0一切正常(在使用exmaple代码,也在我自己的网页上),但只有当我在localhost上测试它.在github页面上部署后,我遇到了很多错误:
GET https://[myusername].github.io/manifest.json 404 ()
(即路径可能有问题,因为我猜在清单文件之前应该有项目名称)Manifest: Line: 1, column: 1, Unexpected token.
(在devtools中我可以看到虽然它是正常的json文件,但它在我的localhost上工作正常);TypeError: Failed to register a ServiceWorker: A bad
HTTP response code (404) was received when fetching the script.
Manifest: Line: 1, column: 1, Unexpected token.
和Site cannot be installed: the manifest could not be fetched, is empty, or could not be parsed
.有任何想法吗?我不知道我做错了什么或者github页面出了什么问题......