简体   繁体   English

在Angular 2应用和静态html页面之间共享的Material Design CSS / JS

[英]Material Design CSS/JS shared between Angular 2 app and static html page

Our Angular 2 app uses the Material Design framework. 我们的Angular 2应用程序使用了Material Design框架。 The app will end up as a locally served (serverless) web app on a piece of embedded software. 该应用程序最终将作为一个嵌入式软件上的本地服务(无服务器)网络应用程序。 For performance we have found it imperative to use non-Angular static html in certain situations due to load time for a couple places in the app. 为了提高性能,我们发现必须在某些情况下使用非角度静态html,这是因为应用程序中有两个地方需要加载时间。

I want our UI/UX programmer to be able to use as many of the md- prefixed components and CSS/JS animations within the static html pages. 我希望我们的UI / UX程序员能够在静态html页面中使用尽可能多的带有md前缀的组件和CSS / JS动画。 In other words I want them to be able to code the UI on a static page just as they would code it within an Angular 2 template, or as close to the same as possible. 换句话说,我希望他们能够像在Angular 2模板中一样对UI进行编码,或者尽可能接近。

I would also like changes or any customization that they make to the CSS or JS to be shared between the Angular 2 templates and the static html pages, as they should have the same look and feel and should look like they are part of the same app. 我还希望在Angular 2模板和静态html页面之间共享对C​​SS或JS所做的更改或任何自定义,因为它们应该具有相同的外观,并且看起来应该属于同一应用程序。

I know there are various ways to implement material design without Angular 2. (bootstrap, polymer, etc.) Does anyone know of a clean way that would make coding seamless between the Angular 2 and non-Angular portions of the web app? 我知道有多种方法可以在不使用Angular 2的情况下实现材料设计(引导程序,聚合物等)。有人知道一种干净的方法可以使Angular 2和Web应用程序的非Angular部分无缝编码吗?

From what I can tell, there are several implementations of material design ( https://material.io/guidelines/ ) for various frameworks available. 据我所知,针对各种可用框架,有几种材料设计的实现( https://material.io/guidelines/ )。 The following which can be used on a static html page without requiring an all-encompassing framework such as Angular 2: 以下内容可以在静态html页面上使用,而无需诸如Angular 2之类的全面框架:

...just to name a few. ...仅举几个。 The one we decided on was the Polymer implementation. 我们决定采用的是Polymer实施。 This is because the polymer syntax is very similar to the angular one. 这是因为聚合物语法与有角语法非常相似。 (both authored by google) Polymer prefixes with 'paper-' instead of 'md-' but otherwise is very similar and we can add both of these prefixes to any overrides in our .scss files which can be shared between the angular templates and the static html files when we need to override the default styles. (均由google撰写)聚合物前缀为'paper-'而不是'md-',但其他方面非常相似,我们可以将这两个前缀添加到.scss文件中的所有替代项中,这些替代项可以在角度模板和静态html文件时我们需要覆盖默认样式。

Although it is not ideal to manage to separate material design implementations, given that we require static html files for certain pages in our app it is an acceptable trade off. 尽管将材料设计实现分开进行管理并不理想,但鉴于我们的应用程序中某些页面需要静态html文件,因此这是可以接受的折衷方案。

Still interested in other solutions to this problem if anyone has any other ideas. 如果有人有其他想法,仍对解决此问题的其他解决方案感兴趣。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM