Copied to clipboard

Flag this post as spam?

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


  • Tom Engan 430 posts 1173 karma points
    Mar 02, 2015 @ 13:18
    Tom Engan
    0

    ClientDependency problem

    When I was moving my site to a testserver without virtual directory (now http://localhost/ with IIS), it's seems like ClientDependency not working anymore.

    Before: <link href="/css/newstext.css?cdv=587856639" type="text/css" rel="stylesheet"/>

    After: <link href="/DependencyHandler.axd?s=L2Nzcy9uZXdzdGV4dC5jc3M7&amp;t=Css&amp;cdv=1570503640" type="text/css" rel="stylesheet"/>

    without changing anything i master.cshtml or other pages.

    Mastercshtml: 
    @using ClientDependency.Core.Mvc (top of page)
    @Html.RenderCssHere() - (used in <head>-section)

    NewsPage.cshtml:  (top of page)
    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using ClientDependency.Core.Mvc 
    @{
    Layout = "Master.cshtml";
    Html.RequiresCss("~/css/newstext.css");
    }

    Umbraco version 7.2.2

    ClientDependency.Core.Mvc version: 1.8.0.0

    Any ideas?

     

  • Tom Engan 430 posts 1173 karma points
    Mar 02, 2015 @ 14:14
    Tom Engan
    1

    Ok, found it.

    Changed <compilation debug="false"> to <compilation debug="true"> in Web.config, and ClientDependency now generate <link href="/css/newstext.css?cdv=1570503640" type="text/css" rel="stylesheet"/> :-)

  • Kevin Jump 2312 posts 14698 karma points MVP 7x c-trib
    Mar 02, 2015 @ 17:55
    Kevin Jump
    0

    Hi 

    Just to say - the script /dependencyhandler.... is ClientDependy working. when debug = false, it is taking all the stylesheets finds, minifing them and then serving that as the stylesheet - when debug = true is set it is just putting the stylesheet link into the html, with no minification or combining. 

    setting your whole site to debug=true will have knock on effects with other things as everything will be running in debug mode - if you want client dependency to behave diffrently but not run the whole site in debug mode you can change settings in /config/clientdependency.config. 

  • Tom Engan 430 posts 1173 karma points
    Mar 03, 2015 @ 00:13
    Tom Engan
    0

    Yes of course, you're right. I forgot completely. Shall check this up tomorrow.

  • Tom Engan 430 posts 1173 karma points
    Mar 03, 2015 @ 16:31
    Tom Engan
    0

    Sombody who knows the basic what to configure in /config/clientdependency.config so I don't have to set debug=true in web.config?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Mar 03, 2015 @ 16:33
    Jan Skovgaard
    0

    Hi Tom

    Not sure if you can change that but if you can I think you will find the information here https://github.com/Shazwazza/ClientDependency/wiki

    /Jan

  • Tom Engan 430 posts 1173 karma points
    Mar 05, 2015 @ 12:34
    Tom Engan
    0

    The problem is, I can't find how to use ClientDependency without setting debug=true (not working without).
    But, should't normaly work without configuration of /config/clientdependency.config, just with default settings?

    Anybody have ideas? Otherwise I'm need an other, alternativ method for dividing up the pages where I can choose different stylesheets after type of template.

  • Kevin Jump 2312 posts 14698 karma points MVP 7x c-trib
    Mar 05, 2015 @ 13:43
    Kevin Jump
    0

    Hi Tom

    I'm not 100% sure i know what you want the ClientDependency Module to do ?

    by default you add the CSS and JS you require to the top of your templates, views or macros, and the client dependency framework will work out what css/js the page needs, gather it all together and create a single css or js file and inject it into the page at the RenderCssHere or RenderJSHere location.

    you can have different requirements throughout your site, so if you have a stylesheet on the template and one in the macro, then the CDF will create a single file for that situation, and when you render a page without the macro on, a different cdf file will be created with just those files required.

    if you have nested templates, then again at each level you can put the required CSS/JS into the page, and client dependency will work it out and create the resulting css/js based on the requirements on each template and child template.

    Setting debug=false, just turns of this concatenation and minification of those files, It's still the same css/js - it is just easier to develop in debug=false because there isn't any caching done of the css or js files (so you make a change, reload the page and see it) -

    once in production you set it to debug=true, and the link and script tags are just pushed together - this is better for the end user, as they get one minified and cached file delivered to them, so it's smaller, and quicker in the browser.

  • Tom Engan 430 posts 1173 karma points
    Mar 05, 2015 @ 14:29
    Tom Engan
    0

    Here is som examples with use of ClientDependency in my Umbraco-site:

    /* Example home-template with carousel (debug="true")<= WORKING  */
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/css/rte.css">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    <link href="/css/home.css?cdv=1570503640" type="text/css" rel="stylesheet"/>
    <link href="/css/carousel.css?cdv=1570503640" type="text/css" rel="stylesheet"/>

    /* Example newstext-template (debug="true") <= WORKING */
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/css/rte.css">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    <link href="/css/newstext.css?cdv=1570503640" type="text/css" rel="stylesheet"/>

     

    Here are an example of the same page, only debug is changed:

    /* Example newstext-template with carousel (debug="true") <= WORKING */
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/css/rte.css">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    <link href="/css/newstext.css?cdv=1570503640" type="text/css" rel="stylesheet"/>
    <link href="/css/carousel.css?cdv=1570503640" type="text/css" rel="stylesheet"/>

    /* Example newstext-template with carousel (debug="false") <= NOT WORKING */
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/css/rte.css">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    <link href="/DependencyHandler.axd?s=L2Nzcy9uZXdzdGV4dC5jc3M7L2Nzcy9jYXJvdXNlbC5jc3M7&amp;t=Css&amp;cdv=1570503640" type="text/css" rel="stylesheet"/>

    CSS specified with DependencyHandler don't seems to activate when debug="false" (behave differently when debug ="false" and debug="true") 

    Just wonder, am I missing any settings somewhere (see top of this page)?
    Can there bee a problem with changing in the order of CSS?

  • Kevin Jump 2312 posts 14698 karma points MVP 7x c-trib
    Mar 05, 2015 @ 14:42
    Kevin Jump
    101

    Hi

    The dependency handler should put them in in the same order, but it does cache things to disk, so might be doing it with older files.

    if you go to ClientDependency.config in the config folder, and just change the number in the Version="xxxxxx" attribute (i just increment it by one usually), you can force CDF to rebuild it's own cache.

  • Tom Engan 430 posts 1173 karma points
    Mar 05, 2015 @ 15:09
    Tom Engan
    0

    Yes, this worked! Changed only <clientDependency version="1570503640" to <clientDependency version="1570503641" in ClientDependency.config.  Thanks! :-)

  • Kevin Jump 2312 posts 14698 karma points MVP 7x c-trib
    Mar 05, 2015 @ 15:11
    Kevin Jump
    0

    Cool !

    Most of the time it isn't a problem, if you add or remove a RequiresJS or RequestCSS line in a template then the CDF will build a new cached version, but if nothing else changes then the cache remains, but you just have to tickle it :)

Please Sign in or register to post replies

Write your reply to:

Draft