jquery - Using php code in css file to create dynamic css dosen't works each time.. sometimes dynamic css not loaded only static rules in that css are loaded -


i trying create dynamic css. appending variable in each rule of css. have tried variable using cookie,session , method works 1 out of 10 times.

css file (component.min.css) :

<?php header('content-type: text/css; charset: utf-8'); header('cache-control: must-revalidate'); $appvar = "";  if(!empty($_cookie["_adl_appvar"])) {     $appvar = $_cookie['_adl_appvar'];   } elseif(!empty($_session['_adl_appvar'])) {     $appvar = $_session['_adl_appvar'];  }  ?>  /* general styles modal */  /*  styles html/body special modal want 3d effects note need container wrapping content on page  perspective effects (not including modals , overlay). */ .<?php echo $appvar ?>abs<?php echo $appvar ?>-perspective, .<?php echo $appvar ?>abs<?php echo $appvar ?>-perspective body {     height: 100%;     overflow: hidden; }  .<?php echo $appvar ?>abs<?php echo $appvar ?>-perspective body  {     background: #fff;     -webkit-perspective: 600px;     -moz-perspective: 600px;     perspective: 600px; } .container {     min-height: 100%; } 

.htaccess file

<ifmodule mod_rewrite.c>   rewriteengine on </ifmodule> <filesmatch "^.*?component.min.*?$"> sethandler php5-script </filesmatch> 

let's above case output css

rendered css (incorrect)

.container {     min-height: 100%; } 

while if should rendered :-

/* general styles modal */  /*  styles html/body special modal want 3d effects note need container wrapping content on page  perspective effects (not including modals , overlay). */ .9d94584f3c1af62a2078da0ec45702baabs9d94584f3c1af62a2078da0ec45702ba-perspective, .9d94584f3c1af62a2078da0ec45702baabs9d94584f3c1af62a2078da0ec45702ba-perspective body {     height: 100%;     overflow: hidden; }  .9d94584f3c1af62a2078da0ec45702baabs9d94584f3c1af62a2078da0ec45702ba-perspective body  {     background: #fff;     -webkit-perspective: 600px;     -moz-perspective: 600px;     perspective: 600px; }  .container {     min-height: 100%; } 

i loading css file using jquery (please see below) :-

$("head").append('<link rel="stylesheet" href="path/to/css/component.min.css" id="component-css" type="text/css" media= "screen" />'); 

i have found mistake doing.

actually problem not php side or .htaccess side. problem dynamic css classes generating, when generating random classes generated classes starting digit , css doesn't support that.

thank you


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -