我正在尝试将我的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.cssYou 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更多推荐
发布评论