Beispiel #1
0
        /// <summary>
        /// Creates a pre-defined bundle and sets the priority and group for each file supplied, unless any of the files already have a priority/group set
        /// </summary>
        /// <param name="name"></param>
        /// <param name="priority"></param>
        /// <param name="group"></param>
        /// <param name="files"></param>
        public static void CreateJsBundle(string name, int priority, int group, params JavascriptFile[] files)
        {
            //set priorities on files that don't have one set already
            var filesToChange = files.Where(x => x.Priority == Constants.DefaultPriority);

            foreach (var f in filesToChange)
            {
                f.Priority = priority;
            }
            //set groups on files that don't have one set already
            filesToChange = files.Where(x => x.Group == Constants.DefaultGroup);
            foreach (var f in filesToChange)
            {
                f.Group = group;
            }

            var def = new BundleDefinition(ClientDependencyType.Javascript, name);

#if !Net35
            Bundles.AddOrUpdate(def, s => OrderFiles(files), (s, enumerable) => OrderFiles(files));
#else
            lock (DictionaryLocker)
            {
                Bundles[def] = OrderFiles(files);
            }
#endif
        }
Beispiel #2
0
        public static void CreateJsBundle(string name, params JavascriptFile[] files)
        {
            var def = new BundleDefinition(ClientDependencyType.Javascript, name);

#if !Net35
            Bundles.AddOrUpdate(def, s => OrderFiles(files), (s, enumerable) => OrderFiles(files));
#else
            lock (DictionaryLocker)
            {
                Bundles[def] = OrderFiles(files);
            }
#endif
        }
 protected bool Equals(BundleDefinition other)
 {
     return(Type == other.Type && string.Equals(Name, other.Name));
 }
 protected bool Equals(BundleDefinition other)
 {
     return Type == other.Type && string.Equals(Name, other.Name);
 }