我的小型Polymer 1.0 Starter Kit应用程序需要5秒钟才能加载。该网站还使用Page.js。
关于如何加速您的聚合物应用,我正在关注this tutorial。但是我在视频部分。
我在我的应用和设置中使用了loadCSS:
<head>
<script src="scripts/loadCSS.js"></script>
<script src="scripts/onloadCSS.js"></script>
<!-- build:js bower_components/webcomponentsjs/webcomponents-lite.min.js -->
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<!-- endbuild -->
<!-- will be replaced with elements/elements.vulcanized.html -->
<link rel="import" href="elements/elements.html">
<!-- endreplace-->
</head>
<body>
<span id="browser-sync-binding"></span>
<template is="dom-bind" id="app">
<paper-header-panel main mode="waterfall">
<paper-toolbar>
//web links etc
</paper-toolbar>
// Main Content
<div class="content" style="display:none">
<script>
onloadCSS(loadCSS('styles/main.css'), function() {
document.querySelector('.content')
.style.display = ''; // should show the content after css is loaded?
});
</script>
<noscript><link rel="stylesheet" href="/styles/main.css"></noscript>
<noscript><link rel="stylesheet" href="/styles/skeleton.css"></noscript>
<iron-pages attr-for-selected="data-route" selected="{{route}}">
// all the elements ie: <my-app></my-app>
</iron-papes>
</div>
</paper-header-panel>
</template>
</body>
只加载<paper-toolbar>
而不加载任何其他内容。为什么.style.display = '';
不起作用?
由于