質問

I have an application that let's users specify custom css along with our pre-determined css. I'd like it so that when we request the user's css file, we return a file that dynamically compiles the base css with the user-specific css. This is relatively easy to do if we're serving the assets from our own server, but if at some point I'd like to serve all my static assets from a CDN, is there a CDN that would let you do this? I know I could always upload a separate css file for each user to the CDN, but there would be tons of duplication of the base CSS which would unneccessarily raise storage costs.

役に立ちましたか?

解決

Why don't you split your CSS into two separate files?

  1. static CSS served by the CDN
  2. dynamic (user generated) CSS served by a script on your server

Your HTML will then look something like this:

<link href="./dynStyles.css" rel="stylesheet" type="text/css" media="all">
<link href="http://my.cdn.com/staticStyles.css" rel="stylesheet" type="text/css" media="all">
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top