@@ -313,7 +313,7 @@ public static IHtmlString RenderCssHere(this HtmlHelper html, string rendererNam
313313 /// <returns></returns>
314314 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , string searchFilter )
315315 {
316- return html . RequiresFolder ( folderPath , 100 , searchFilter , ( absPath , pri ) => html . RequiresJs ( absPath , pri ) ) ;
316+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresJs ( absPath , 100 ) ) ;
317317 }
318318
319319 /// <summary>
@@ -326,7 +326,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
326326 /// <returns></returns>
327327 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority )
328328 {
329- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresJs ( absPath , pri ) ) ;
329+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresJs ( absPath , priority ) ) ;
330330 }
331331
332332 /// <summary>
@@ -340,7 +340,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
340340 /// <returns></returns>
341341 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , int group )
342342 {
343- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresJs ( absPath , pri , group ) ) ;
343+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresJs ( absPath , priority , group ) ) ;
344344 }
345345
346346 /// <summary>
@@ -355,7 +355,28 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
355355 /// <returns></returns>
356356 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , int group , object htmlAttributes )
357357 {
358- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresJs ( absPath , pri , group , htmlAttributes ) ) ;
358+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresJs ( absPath , priority , group , htmlAttributes ) ) ;
359+ }
360+
361+ public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , int group , object htmlAttributes , string forcedProvider )
362+ {
363+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) =>
364+ {
365+ var file = new JavascriptFile ( absPath )
366+ {
367+ ForceProvider = forcedProvider ,
368+ Group = @group ,
369+ Priority = priority
370+ } ;
371+
372+ //now add the attributes to the list
373+ foreach ( var d in htmlAttributes . ToDictionary ( ) )
374+ {
375+ file . HtmlAttributes . Add ( d . Key , d . Value . ToString ( ) ) ;
376+ }
377+
378+ html . RequiresJs ( file ) ;
379+ } ) ;
359380 }
360381
361382 /// <summary>
@@ -369,7 +390,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
369390 /// <returns></returns>
370391 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , object htmlAttributes )
371392 {
372- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresJs ( absPath , pri , htmlAttributes ) ) ;
393+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresJs ( absPath , priority , htmlAttributes ) ) ;
373394 }
374395
375396 /// <summary>
@@ -382,7 +403,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
382403 /// <returns></returns>
383404 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , string searchFilter , object htmlAttributes )
384405 {
385- return html . RequiresFolder ( folderPath , 100 , searchFilter , ( absPath , pri ) => html . RequiresJs ( absPath , pri , htmlAttributes ) ) ;
406+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresJs ( absPath , 100 , htmlAttributes ) ) ;
386407 }
387408
388409 /// <summary>
@@ -405,7 +426,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
405426 /// <returns></returns>
406427 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , int priority )
407428 {
408- return html . RequiresFolder ( folderPath , priority , "*.js" , ( absPath , pri ) => html . RequiresJs ( absPath , pri ) ) ;
429+ return html . RequiresFolder ( folderPath , "*.js" , ( absPath ) => html . RequiresJs ( absPath , priority ) ) ;
409430 }
410431
411432 /// <summary>
@@ -418,7 +439,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
418439 /// <returns></returns>
419440 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , int priority , int group )
420441 {
421- return html . RequiresFolder ( folderPath , priority , "*.js" , ( absPath , pri ) => html . RequiresJs ( absPath , pri , group ) ) ;
442+ return html . RequiresFolder ( folderPath , "*.js" , ( absPath ) => html . RequiresJs ( absPath , priority , group ) ) ;
422443 }
423444
424445 /// <summary>
@@ -432,7 +453,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
432453 /// <returns></returns>
433454 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , int priority , int group , object htmlAttributes )
434455 {
435- return html . RequiresFolder ( folderPath , priority , "*.js" , ( absPath , pri ) => html . RequiresJs ( absPath , pri , group , htmlAttributes ) ) ;
456+ return html . RequiresFolder ( folderPath , "*.js" , ( absPath ) => html . RequiresJs ( absPath , priority , group , htmlAttributes ) ) ;
436457 }
437458
438459 /// <summary>
@@ -445,7 +466,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
445466 /// <returns></returns>
446467 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , int priority , object htmlAttributes )
447468 {
448- return html . RequiresFolder ( folderPath , priority , "*.js" , ( absPath , pri ) => html . RequiresJs ( absPath , pri , htmlAttributes ) ) ;
469+ return html . RequiresFolder ( folderPath , "*.js" , ( absPath ) => html . RequiresJs ( absPath , priority , htmlAttributes ) ) ;
449470 }
450471
451472 /// <summary>
@@ -457,7 +478,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
457478 /// <returns></returns>
458479 public static HtmlHelper RequiresJsFolder ( this HtmlHelper html , string folderPath , object htmlAttributes )
459480 {
460- return html . RequiresFolder ( folderPath , 100 , "*.js" , ( absPath , pri ) => html . RequiresJs ( absPath , pri , htmlAttributes ) ) ;
481+ return html . RequiresFolder ( folderPath , "*.js" , ( absPath ) => html . RequiresJs ( absPath , 100 , htmlAttributes ) ) ;
461482 }
462483
463484 #endregion
@@ -472,7 +493,7 @@ public static HtmlHelper RequiresJsFolder(this HtmlHelper html, string folderPat
472493 /// <returns></returns>
473494 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , string searchFilter )
474495 {
475- return html . RequiresFolder ( folderPath , 100 , searchFilter , ( absPath , pri ) => html . RequiresCss ( absPath , pri ) ) ;
496+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresCss ( absPath , 100 ) ) ;
476497 }
477498
478499 /// <summary>
@@ -485,7 +506,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
485506 /// <returns></returns>
486507 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority )
487508 {
488- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresCss ( absPath , pri ) ) ;
509+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresCss ( absPath , priority ) ) ;
489510 }
490511
491512 /// <summary>
@@ -499,7 +520,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
499520 /// <returns></returns>
500521 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , int group )
501522 {
502- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresCss ( absPath , pri , group ) ) ;
523+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresCss ( absPath , priority , group ) ) ;
503524 }
504525
505526 /// <summary>
@@ -514,7 +535,28 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
514535 /// <returns></returns>
515536 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , int group , object htmlAttributes )
516537 {
517- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresCss ( absPath , pri , group , htmlAttributes ) ) ;
538+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresCss ( absPath , priority , group , htmlAttributes ) ) ;
539+ }
540+
541+ public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , int group , object htmlAttributes , string forcedProvider )
542+ {
543+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) =>
544+ {
545+ var file = new CssFile ( absPath )
546+ {
547+ ForceProvider = forcedProvider ,
548+ Group = @group ,
549+ Priority = priority
550+ } ;
551+
552+ //now add the attributes to the list
553+ foreach ( var d in htmlAttributes . ToDictionary ( ) )
554+ {
555+ file . HtmlAttributes . Add ( d . Key , d . Value . ToString ( ) ) ;
556+ }
557+
558+ html . RequiresJs ( file ) ;
559+ } ) ;
518560 }
519561
520562 /// <summary>
@@ -528,7 +570,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
528570 /// <returns></returns>
529571 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , string searchFilter , int priority , object htmlAttributes )
530572 {
531- return html . RequiresFolder ( folderPath , priority , searchFilter , ( absPath , pri ) => html . RequiresCss ( absPath , pri , htmlAttributes ) ) ;
573+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresCss ( absPath , priority , htmlAttributes ) ) ;
532574 }
533575
534576 /// <summary>
@@ -541,7 +583,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
541583 /// <returns></returns>
542584 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , string searchFilter , object htmlAttributes )
543585 {
544- return html . RequiresFolder ( folderPath , 100 , searchFilter , ( absPath , pri ) => html . RequiresCss ( absPath , pri , htmlAttributes ) ) ;
586+ return html . RequiresFolder ( folderPath , searchFilter , ( absPath ) => html . RequiresCss ( absPath , 100 , htmlAttributes ) ) ;
545587 }
546588
547589 /// <summary>
@@ -564,7 +606,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
564606 /// <returns></returns>
565607 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , int priority )
566608 {
567- return html . RequiresFolder ( folderPath , priority , "*.css" , ( absPath , pri ) => html . RequiresCss ( absPath , pri ) ) ;
609+ return html . RequiresFolder ( folderPath , "*.css" , ( absPath ) => html . RequiresCss ( absPath , priority ) ) ;
568610 }
569611
570612 /// <summary>
@@ -577,7 +619,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
577619 /// <returns></returns>
578620 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , int priority , int group )
579621 {
580- return html . RequiresFolder ( folderPath , priority , "*.css" , ( absPath , pri ) => html . RequiresCss ( absPath , pri , group ) ) ;
622+ return html . RequiresFolder ( folderPath , "*.css" , ( absPath ) => html . RequiresCss ( absPath , priority , group ) ) ;
581623 }
582624
583625 /// <summary>
@@ -591,7 +633,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
591633 /// <returns></returns>
592634 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , int priority , int group , object htmlAttributes )
593635 {
594- return html . RequiresFolder ( folderPath , priority , "*.css" , ( absPath , pri ) => html . RequiresCss ( absPath , pri , group , htmlAttributes ) ) ;
636+ return html . RequiresFolder ( folderPath , "*.css" , ( absPath ) => html . RequiresCss ( absPath , priority , group , htmlAttributes ) ) ;
595637 }
596638
597639 /// <summary>
@@ -604,7 +646,7 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
604646 /// <returns></returns>
605647 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , int priority , object htmlAttributes )
606648 {
607- return html . RequiresFolder ( folderPath , priority , "*.css" , ( absPath , pri ) => html . RequiresCss ( absPath , pri , htmlAttributes ) ) ;
649+ return html . RequiresFolder ( folderPath , "*.css" , ( absPath ) => html . RequiresCss ( absPath , priority , htmlAttributes ) ) ;
608650 }
609651
610652 /// <summary>
@@ -616,11 +658,11 @@ public static HtmlHelper RequiresCssFolder(this HtmlHelper html, string folderPa
616658 /// <returns></returns>
617659 public static HtmlHelper RequiresCssFolder ( this HtmlHelper html , string folderPath , object htmlAttributes )
618660 {
619- return html . RequiresFolder ( folderPath , 100 , "*.css" , ( absPath , pri ) => html . RequiresCss ( absPath , pri , htmlAttributes ) ) ;
661+ return html . RequiresFolder ( folderPath , "*.css" , ( absPath ) => html . RequiresCss ( absPath , 100 , htmlAttributes ) ) ;
620662 }
621663 #endregion
622664
623- private static HtmlHelper RequiresFolder ( this HtmlHelper html , string folderPath , int priority , string fileSearch , Action < string , int > requiresAction )
665+ private static HtmlHelper RequiresFolder ( this HtmlHelper html , string folderPath , string fileSearch , Action < string > requiresAction )
624666 {
625667 var httpContext = html . ViewContext . HttpContext ;
626668 var systemRootPath = httpContext . Server . MapPath ( "~/" ) ;
@@ -632,8 +674,7 @@ private static HtmlHelper RequiresFolder(this HtmlHelper html, string folderPath
632674 foreach ( var file in files )
633675 {
634676 var absoluteFilePath = "~/" + file . Substring ( systemRootPath . Length ) . Replace ( "\\ " , "/" ) ;
635- requiresAction ( absoluteFilePath , priority ) ;
636- html . RequiresJs ( absoluteFilePath , priority ) ;
677+ requiresAction ( absoluteFilePath ) ;
637678 }
638679 }
639680
0 commit comments