创建自定义css或js文件服务器端

时间:2022-01-21 16:32:42

so this question is to just see what's our there or how different people would handle something like this. I work for a company where we've started creating a more modular driven approach to our front end development. So we have for example a table module where some HTML, some CSS and some JS belong specifically to that module.

所以这个问题只是看看我们在那里有什么,或者不同的人会如何处理这样的事情。我在一家公司工作,我们已经开始为我们的前端开发创建一个更加模块化的驱动方法。所以我们有一个表模块,其中一些HTML,一些CSS和一些JS专门属于该模块。

What we'd like to do is create something like bootstrap has done here: http://getbootstrap.com/customize/

我们想要做的是创建像bootstrap这样的东西:http://getbootstrap.com/customize/

Any thoughts on the best way to do something like this?

关于做这样事情的最佳方式的任何想法?

Thanks for any ideas or thoughts, just curious!

感谢任何想法或想法,只是好奇!

1 个解决方案

#1


In this case you can have a final file where you can append features that you want. After appending all feature needed can now download the final file with all the features you wanted inside one file.

在这种情况下,您可以拥有一个最终文件,您可以在其中附加所需的功能。附加所需的所有功能后,现在可以在一个文件中下载包含所需功能的最终文件。

<?php
  //the final file where you want to add your selected features/
  $finalFile = 'final.css';
  //the feature you wanted to add.
  $feature = 'feature1.css';
  //append the feature to the finale file.
  file_put_contents($finalFile, $feature, FILE_APPEND | LOCK_EX);
?>

Now can use this idea using checkbox for the feature you want.

现在可以使用这个想法使用复选框来获得所需的功能。

#1


In this case you can have a final file where you can append features that you want. After appending all feature needed can now download the final file with all the features you wanted inside one file.

在这种情况下,您可以拥有一个最终文件,您可以在其中附加所需的功能。附加所需的所有功能后,现在可以在一个文件中下载包含所需功能的最终文件。

<?php
  //the final file where you want to add your selected features/
  $finalFile = 'final.css';
  //the feature you wanted to add.
  $feature = 'feature1.css';
  //append the feature to the finale file.
  file_put_contents($finalFile, $feature, FILE_APPEND | LOCK_EX);
?>

Now can use this idea using checkbox for the feature you want.

现在可以使用这个想法使用复选框来获得所需的功能。