WordPress.org

Support

Support » Plugins and Hacks » Easy FancyBox » [Resolved] Don't put CSS in the

[Resolved] Don't put CSS in the

  • sccr410

    @sccr410

    The plugin needs to stop placing all the CSS code in the <head> of the document and put it in a single .css file. There is nothing in the CSS code that requires it be put in the <head>. I understand the need for the JS to be in the head, but definitely not the CSS.

    http://wordpress.org/plugins/easy-fancybox/

Viewing 8 replies - 1 through 8 (of 8 total)
  • sccr410

    @sccr410

    Just a note that I love this plugin and use it on almost every client website. Just this one thing bugs the hell out of me since I like really lean/clean code.

    Plugin Author RavanH

    @ravanh

    Sorry, but there IS a need for this CSS in the head.

    For instance, the paths in that CSS are dependent of your installation. If not generated dynamically, they will break IE6/7/8 support… All static CSS (meaning it does not need specific adaptation) is loaded via the static fancybox.css file.

    sccr410

    @sccr410

    But those are not dynamic URLs, they are all pointing to files within your plugin and so can be included in a single common CSS file.

    Plugin Author RavanH

    @ravanh

    Some people have WordPress installed in a subdirectory, some have plugins installed in another that the default /wp-content/plugins directory. And all have another domain name…

    For instance, no site but my own will have src="http://status301.net/wp-content/plugins/easy-fancybox/fancybox/fancy_close.png" as DXImageTransform.Microsoft.AlphaImageLoader parameter.

    sccr410

    @sccr410

    All paths in a CSS file are relative. Even in the official download from http://www.fancybox.net those lines of CSS use relative paths. So there is absolutely no need to include the CSS code in the <head>.

    For those ie6 classes in the Fancybox CSS file, those are relative to the JS file. Since the JS file is in your plugin, you can just make it relative to that JS file.

    I’d be more than happy to contribute and fix this for you if needed.

    Plugin Author RavanH

    @ravanh

    Sorry to insist here but the IE specific “AlphaImageLoader” filter needs either full paths or at least relative to root, not relative to the stylesheet. In bot cases, this means dynamic path generation for the WordPress plugin.

    In older versions I used a dynamic stylesheet (generated by PHP on each request) but that posed issues for some webservers and in combination with some security plugins. So I chose to put these in the head section instead.

    You can downgrade to http://downloads.wordpress.org/plugin/easy-fancybox.1.5.2.zip if you really want to use a (dynamic) stylesheet for ALL style rules. But do not expect a faster user experience…

    You were right about the paths, sorry about that (I never use them since I simply don’t care about old IE)

    I’m not expecting a faster user experience by cleaning up the <head>, but we have just had a couple 3rd party SEO companies tell us to clean up the code so there is not so much in the <head>.

    I personally feel IE6/7/8 support is no longer necessary for this one CSS rule. I think WordPress itself has even stopped supporting 6/7

    Plugin Author RavanH

    @ravanh

    I personally feel IE6/7/8 support is no longer necessary for this one CSS rule. I think WordPress itself has even stopped supporting 6/7

    I’ll be happy to drop support for them too (glad to see the end of them) but many users still expect those browsers to work… I’ll consider an option to disable these IE rules in the head for the next version. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Don't put CSS in the’ is closed to new replies.
Skip to toolbar