WordPress.org

Forums

Easy FancyBox
[resolved] Don't put CSS in the (9 posts)

  1. sccr410
    Member
    Posted 1 year ago #

    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/

  2. sccr410
    Member
    Posted 1 year ago #

    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.

  3. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  4. sccr410
    Member
    Posted 1 year ago #

    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.

  5. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  6. sccr410
    Member
    Posted 1 year ago #

    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.

  7. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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...

  8. sccr410
    Member
    Posted 1 year ago #

    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

  9. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.