简体   繁体   English

使用 Node.JS 根据用户输入创建样式表

[英]Creating a Style Sheet Based on User Inputs With Node.JS

I'm looking for a way to create a custom user style sheet, based off of user inputs, using user inputs.我正在寻找一种方法来创建自定义用户样式表,基于用户输入,使用用户输入。 Basically, users select different options, such as background colors etc., and then the app will create a style sheet based off their inputs.基本上,用户选择不同的选项,例如背景颜色等,然后​​应用程序将根据他们的输入创建一个样式表。 Their inputs are done through HTML inputs tied to some jQuery functions.它们的输入是通过与某些 jQuery 函数相关联的 HTML 输入完成的。 The style sheets will be saved in a user database, that they can potentially view/download.样式表将保存在用户数据库中,以便他们可以查看/下载。

What's the best way to approach this?解决这个问题的最佳方法是什么?

There are two ways to achieve this:有两种方法可以实现这一点:

  1. Save css in database将css保存在数据库中
  2. Create actually file and while viewing parse it to display style classes.创建实际文件并在查看时解析它以显示样式类。

Go through step below:执行以下步骤:

Step one: Answer your question in yes or no第一步:以是或否回答你的问题

  1. Is your application is for web designers?您的应用程序是为网页设计师设计的吗?
  2. Is your application has one feature of theme?您的应用程序是否具有主题的一项功能?
  3. Is there is frequent changes in css styling? css样式是否经常变化?
  4. Is this feature for end user?此功能适用于最终用户吗?

Step two: Find out your answer with keeping user in mind.第二步:找出你的答案,同时牢记用户。

Step three: Take decision第三步:做出决定

If question 1 and 3 is yes then save it is in database and when web designer publish changes make style sheet, and fetch from DB for viewing.如果问题 1 和 3 为是,则将其保存在数据库中,当网页设计师发布更改时制作样式表,并从数据库中获取以供查看。

If question 2 and 4 is yes then make style sheet, use that when you going to apply that sheet and parse for viewing.如果问题 2 和 4 是“是”,则制作样式表,当您要应用该表并解析以进行查看时使用它。

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

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