聚合物硫化CSS(Polymer Vulcanize CSS)

编程入门 行业动态 更新时间:2024-10-23 20:17:52
聚合物硫化CSS(Polymer Vulcanize CSS)

我正在尝试将我的Polymer Web应用程序打包为Chrome Packaged应用程序,但我遇到了有关Chrome内容安全策略(CSP)的一些问题。 在打包之前,我正在硫化应用程序(使用--csp选项),这对JavaScript部分非常--csp ,但未能提取聚合物元素中内联的CSS。 有没有办法来1)覆盖聚合物的CSS的CSP或2)提取CSS并将其放置在一个单独的文件中的所有聚合物元素?

据我所知,在工作中有一个PR来解决这个问题,但自从8月份以来它一直没有更新: https : //github.com/Polymer/vulcanize/pull/33 。

I am trying to package my Polymer web app as a Chrome Packaged App, but I am running into some issues surrounding Chrome's Content Security Policy (CSP). I am vulcanizing the app (with the --csp option) before packaging it, which works great for the JavaScript portion, but fails to extract the CSS inlined in Polymer's elements. Is there any way to either 1) override the CSP for Polymer's CSS or 2) extract the CSS and place it in a separate file for all Polymer elements?

As far as I can tell, there is a PR in the works to resolve this issue, but it hasn't been updated since August: https://github.com/Polymer/vulcanize/pull/33.

最满意答案

您可以使用gulp-cssmin将从内联htmls提取的css与vulcanize --csp选项连接起来。

在Github页面查看clean-css的例子:

type one.css two.css three.css | cleancss -o merged-and-minified.css

You can use gulp-cssmin to concatenate your css extracted from inline htmls with vulcanize --csp option.

See example of clean-css in Github page:

type one.css two.css three.css | cleancss -o merged-and-minified.css

更多推荐

本文发布于:2023-07-15 19:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:聚合物   CSS   Vulcanize   Polymer

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!