This project is read-only.
1
Vote

Using two match groups for consolidation by convention

description

hi

i'm trying to consolidate these four bundles into 1
 <group consolidatedUrl="~/scripts/en-gb/{env}/dcstorm_in_head.js" minify="ReleaseOnly">
            <include>
                <add regex="~/Scripts/en-GB/(?'env'\w+)/.+" />
                <add path="~/Scripts/affexecute.js" />
            </include>
        </group>
        
        <group consolidatedUrl="~/scripts/de-de/{env}/dcstorm_in_head.js" minify="ReleaseOnly">
            <include>
                <add regex="~/Scripts/de-De/(?'env'\w+)/.+" />
                <add path="~/Scripts/affexecute.js" />
            </include>
        </group>
...and a whole bunch more countries...

i'm referencing the scripts/en-GB/stage/somescript.js in the view... but if i change the bundle name to have two match groups
    <group consolidatedUrl="~/scripts/{country}/{env}/dcstorm_in_head.js" minify="ReleaseOnly">
            <include>
                <add regex="~/Scripts/(?'country'[^\/]+)/(?'env'\w+)/.+" />
                <add path="~/Scripts/affexecute.js" />
            </include>
        </group>
i've changed the regex from checking for \w to [^\/]+ because first off this makes it more robust for weird (yet valid characters) in folder names, and second i've got a '-' so it would blow up. it might be worth changing your standard example!?

anyway any help greatly appreciated. the correct bundle shows up on the page in the correct slot - but on inspecting the contents of the js bundle it tells me it cannot find the file... and looks like it is actually looking for the bundle name itself!

would be GREAT to fix this as i'm once again using this on quite a large production site. we are using the multiple references to the same file fix you kindly created before - and pinning bundles by referencing the bundle name in the layout (for some bundles). for these bundles we are NOT doing that (as i would imagine i cannot pin a bundle with a {something} directive in its name...

comments

andyalm wrote Aug 12, 2013 at 5:09 AM

Hi Rich,

Thanks for reporting this. I will try to reproduce this tomorrow (Monday) and let you know what I find.

~Andy

richhalliwell wrote Aug 12, 2013 at 8:41 AM

That's great Andy

If I can help drop me a message. I'm working on this during work hours GMT all week.

andyalm wrote Aug 13, 2013 at 4:06 AM

Hi Rich,

I believe I have discovered the issue. It's getting thrown off by the fact that there is a specific path to a file referenced in a group with a convention based consolidated Url. The way the code currently works, it converts the path to a regex, and then expects the regex to have named groups for country and env. When it doesn't find them, it basically kicks it out of the group. This is going to be a little bit tricky to fix. I will try to get to it in the next day or so, but there is a lot going on at work at the moment so I can't guarantee anything.

Can you explain a bit more about what you meant when you said that upon inspecting the contents of the js bundle, it tells me it cannot find the file. What file can it not find, and what is the bundle name you are referring to?

~Andy

andyalm wrote Aug 17, 2013 at 12:33 AM

Hi Rich,

I have pushed a beta version of the Assman NuGet package (version 2.1.1-beta) that I hope will resolve your issue. Can you please try it out and let me know how it goes?

I'm sorry it took me a while to get this out. I actually came down with a fever midweek and was not able to get to it until now.

Cheers,

~Andy