Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • wolulcmit 357 posts 693 karma points
    Dec 04, 2009 @ 00:07
    wolulcmit
    0

    linked js files and css files are throwing a 404 error

    Hi  Peter,

    when I enable compression in the web config It seems to do it's thing

    <script src='/js.axd?files=scripts/js/IE7.js,Scripts/js/jquery.min.js,Scripts/js/easySlider.js,Scripts/js/cufon-yui.js,Scripts/js/PMN_Caecilia_700.font.js' type='text/javascript' ></script>
    <link href='/css/css.axd?files=layout-new.css,ie6.css' type='text/css' rel='stylesheet' />

    but these files both return a file not found error..... any idea what I could be doing wrong?
    I have umbraco debug mode set to false, scriptResourceHandler compression is set to false as you specified in the install notes.

    I was expecting some of my stylesheets not to work as I use the @import method from within my main stylesheet.... but wasn't expecting the above.... any ideas?

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Dec 04, 2009 @ 08:44
    Peter Dijksterhuis
    0

    A couple of things to check I guess:

    - Is axd mapped to .NET in IIS?

    - Did you add the lines to the web.config? (httpHandler-section)

    If both above are true, are you using the .NET 3.5 web.config by any chance?

    Peter

  • wolulcmit 357 posts 693 karma points
    Dec 04, 2009 @ 09:05
    wolulcmit
    0

    yes, sorry my bad....
    I forgot these two lines

    <remove verb="*" path="js.axd,css.axd"/>
    <add verb="*" path="js.axd,css.axd" type="PeterD.Compress.CompressionHandler,PeterD.Compress"/>

    yeah, I notice when I run in integrated mode, that the compression no longer works..... any way around this?

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Dec 04, 2009 @ 09:38
    Peter Dijksterhuis
    1

    Glad it was that easy ;)

    Yes, integrated mode should work, you need to alter the web.config a bit. Not sure what exactly from the top of my head, have to look it up tonight when I get home.

  • wolulcmit 357 posts 693 karma points
    Dec 04, 2009 @ 10:10
    wolulcmit
    0

    ok Great.... please add the integrated settings to the documentation if possible for us lesser mortal beings :)

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Dec 04, 2009 @ 18:05
    Peter Dijksterhuis
    1

    For integrated mode, use this (do not alter the system.web part, or if you did, undo that)

    In the system.webserver-part, add this:

    in modules:

    <add 
    name="HttpCompressModule" 
    type="PeterD.Compress.HttpModule,PeterD.Compress"/>

    in handlers:

    <add verb="*" 
    name="PeterD.CSSCompression" path="css.axd" 
    type="PeterD.Compress.CompressionHandler,PeterD.Compress"/>
    <add 
    verb="*" name="PeterD.JSCompression" path="js.axd" 
    type="PeterD.Compress.CompressionHandler,PeterD.Compress"/>

    After that, it should work in integrated mode as well.

    HTH,

    Peter

  • wolulcmit 357 posts 693 karma points
    Dec 07, 2009 @ 20:58
    wolulcmit
    0

    Hi Peter, I finally got the chance to try the above and am happy to say that it works.
    I also took out my @import css rules and linked them in from my main template so that they all get slapped together in the one file.

    I only have one problem now..... after the javascript has been compressed.... it doesn't seem to work anymore. Are there any easy gotcha's to look out for?

    Great package by the way, you can see what a huge difference it makes when comparing compressed and non compressed via ySlow.

    - Tim

  • wolulcmit 357 posts 693 karma points
    Dec 07, 2009 @ 21:38
    wolulcmit
    0

    Figured it out..... needed to add my conditional ie7.js to the exclusion list.... and had to change the order of this around a bit
    for example even after you have added ie7.js to be excluded, if you have your conditional script first:

    <!--[if IE 6]> 
    <script src="/scripts/js/IE7.js" type="text/javascript"></script>
    <![endif]-->

    the compression script seems to latch onto the first script it finds, resulting in:

    <!--[if IE 6]> 
    <script src='/js.axd?files=scripts/js/jquery.min.js,scripts/js/slimbox2.js,Scripts/js/cufon-yui.js,Scripts/js/PMN_Caecilia_700.font.js' type='text/javascript' ></script>
    <script src="/scripts/js/IE7.js" type="text/javascript"></script>
    <![endif]-->

    (even though now IE.js is now referenced seperately as well.... I guess the script see's the first js file as a hook, or place to start)

    hope this helps others who have the same problem.

     

    - Tim

     

Please Sign in or register to post replies

Write your reply to:

Draft