Copied to clipboard

Flag this post as spam?

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


  • philw 99 posts 434 karma points
    May 28, 2018 @ 10:21
    philw
    0

    How to force rebundling

    I had to abandon some old Umbraco systems as I couldn't get them to upgrade, so now I'm starting from scratch once more, this time with a copy of the latest 7.10.4.

    I can't get the build-in bundling code to automatically update the bundles when the referenced CSS or JS files change - the only way I can do it is by creating a new referenced file with a different name and copying all the content over into that. That does work, but is not very useful.

    I've tried everything I can think of to get the bundles to update - recycle the app pool, restart the server, republish the entire site... nothing works.

    Can anyone tell me how to get this simple thing to work? I'm using the straight downloaded zip file as my VS is all Core 2.0 and this doesn't sit well with it.

  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    May 28, 2018 @ 10:34
    Paul Seal
    100

    Hi

    If you are using Client Dependency, you will just need to increment your Client Dependency version number. You can find it in ~/Config/ClientDependencyVersion.config

    Kind regards

    Paul

  • philw 99 posts 434 karma points
    May 28, 2018 @ 10:42
    philw
    0

    Perfect - that works, thanks. I kind of expected it to do automagically, and I couldn't find the setting. The file's called "ClientDependency.config" in my system, and incrementing that number does the job - thanks!

  • Mikael Axel Kleinwort 154 posts 499 karma points c-trib
    Nov 28, 2021 @ 14:57
    Mikael Axel Kleinwort
    0

    For those who are, like me, on Visual Studio without a built server: I am using a simple gulp script which will update ClientDependency version on each build. This should work in Umbraco version 7 & 8.

    Here is my gulp.js:

    /// <binding BeforeBuild='BumpClientDependency' />
    
    var gulp = require('gulp');
    var debug = require('gulp-debug');
    var xmlEdit = require('gulp-edit-xml');
    
    gulp.task("BumpClientDependency", function (done) {
        return gulp.src('Config/ClientDependency.config')
            .pipe(debug({ title: 'updating ' }))
            .pipe(
                xmlEdit(
                    // transform function:
                    function(xml) 
                    {
                        var oldVersion = parseInt(xml.clientDependency.$.version, 10);
                        var newVersion = oldVersion + 1;
    
                        // prevent Int32 overflow in C#
                        var int32Max = 2147483647;
                        if (newVersion >= int32Max) newVersion = 1;
    
                        console.log("Old version: " + xml.clientDependency.$.version);
                        console.log("New version: " + newVersion);
                        xml.clientDependency.$.version = newVersion;
                        return xml;
                    },
                    // options:
                    {
                        parserOptions: {},
                        builderOptions: {
                            headless: true,
                            renderOpts: {
                                pretty: true
                            }
                        }
                    }
                )
            )
            .pipe(gulp.dest('Config/'));
    });
    
Please Sign in or register to post replies

Write your reply to:

Draft