php - Escaping URL for stylesheet & W3C validation -


i have dynamic stylesheet in need provide variables php page, , using .htaccess, rewritten .css. way referenced in <head> of page is:

<link rel="stylesheet" href="assets/css/min.css?style=testing&layout=flat&ver=0.1"> 

the problem when run through w3c validator, says it's invalid code , url needs escaped. but, when escape this:

<link rel="stylesheet" href="assets/css/min.css?style=testing&amp;layout=flat&amp;ver=0.1"> 

the stylesheet not read properly.

what can make valid code , work @ same time?

some solutions pop mind:

1) use 1 parameter in url.

<link rel="stylesheet" href="assets/css/min.css?style=testing_flat_0.1"> 

2) use minification library minify (it's in php), return url this http://www.example.com/?css=70385ee2be4c63d0932eeb51baa1e5af after feed desired css files want minfy - https://github.com/mrclay/minify.

3) use service grunt (https://github.com/gruntjs/grunt-contrib-cssmin) minify , have return w3c valid url.

4) if using framework apllication, try url routing capabilities. can ask css file example:

<link rel="stylesheet" href="assets/testing/css/0.1/min.css"> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -