├── .github └── FUNDING.yml ├── .gitignore ├── Build-Release.ps1 ├── README.md ├── UpgradingUmbraco.txt ├── appveyor.build.yml ├── appveyor.yml ├── assets └── ClientDependencyLogo.png ├── build ├── ClientDependency-Coffee.nuspec ├── ClientDependency-Less.nuspec ├── ClientDependency-Mvc.nuspec ├── ClientDependency-Mvc5.nuspec ├── ClientDependency-SASS.nuspec ├── ClientDependency-TypeScript.nuspec ├── ClientDependency.nuspec └── nuget-transforms │ ├── Coffee │ └── web.config.transform │ ├── Core │ ├── web.config.install.xdt │ └── web.config.uninstall.xdt │ ├── Less │ └── web.config.transform │ ├── Mvc │ └── web.config.transform │ ├── SASS │ └── web.config.transform │ └── TypeScript │ └── web.config.transform └── src ├── ClientDependency.Coffee ├── ClientDependency.Coffee.csproj ├── CoffeeHandler.cs ├── CoffeeWriter.cs ├── Properties │ └── AssemblyInfo.cs ├── StartupHandler.cs └── packages.config ├── ClientDependency.Core ├── BaseLoader.cs ├── BasicFile.cs ├── BasicPath.cs ├── BundleDefinition.cs ├── BundleManager.cs ├── BundleResult.cs ├── ClientDependency.Core.csproj ├── ClientDependency.csproj ├── ClientDependencyAttribute.cs ├── ClientDependencyType.cs ├── CompositeFiles │ ├── CSSMin.cs │ ├── CompositeDependencyHandler.cs │ ├── CompositeFileDefinition.cs │ ├── CompositeFileMap.cs │ ├── CompressionType.cs │ ├── CssMinifier.cs │ ├── DefaultFileWriter.cs │ ├── IFileWriter.cs │ ├── IVirtualFile.cs │ ├── IVirtualFileProvider.cs │ ├── IVirtualFileWriter.cs │ ├── JSMin.cs │ └── Providers │ │ ├── BaseCompositeFileProcessingProvider.cs │ │ ├── BaseFileMapProvider.cs │ │ ├── CompositeFileProcessingProvider.cs │ │ ├── CompositeFileProcessingProviderCollection.cs │ │ ├── CompositeUrlType.cs │ │ ├── FileMapProviderCollection.cs │ │ ├── PathBasedUrlFormatter.cs │ │ └── XmlFileMapper.cs ├── CompressionType.cs ├── Config │ ├── ClientDependencySection.cs │ ├── ClientDependencySettings.cs │ ├── CompositeFileSection.cs │ ├── ConfigurationManagerExtensions.cs │ ├── FileRegistrationSection.cs │ ├── MimeTypeCompressionCollection.cs │ ├── MimeTypeCompressionElement.cs │ ├── MvcSection.cs │ ├── RogueFileCompressionCollection.cs │ ├── RogueFileCompressionElement.cs │ ├── RogueFileCompressionExcludeCollection.cs │ └── RogueFileCompressionExcludeElement.cs ├── Constants.cs ├── ControlExtensions.cs ├── Controls │ ├── ClientDependencyInclude.cs │ ├── ClientDependencyLoader.cs │ ├── ClientDependencyPath.cs │ ├── ClientDependencyPathCollection.cs │ ├── CssFolderInclude.cs │ ├── CssInclude.cs │ ├── DependencyFolderInclude.cs │ ├── HtmlInclude.cs │ ├── JsFolderInclude.cs │ └── JsInclude.cs ├── CssFile.cs ├── CssFileUrlFormatter.cs ├── CssHelper.cs ├── CssMediaType.cs ├── DependencyHtmlElement.cs ├── DependencySorter.cs ├── DictionaryExtensions.cs ├── FileRegistration │ └── Providers │ │ ├── BaseFileRegistrationProvider.cs │ │ ├── BaseRenderer.cs │ │ ├── FileRegistrationProviderCollection.cs │ │ ├── HtmlEmbedContants.cs │ │ ├── LazyLoadProvider.cs │ │ ├── LazyLoadRenderer.cs │ │ ├── LoaderControlProvider.cs │ │ ├── PageHeaderProvider.cs │ │ ├── PlaceHolderProvider.cs │ │ ├── RendererCollection.cs │ │ ├── StandardRenderer.cs │ │ └── WebFormsFileRegistrationProvider.cs ├── FileWriters.cs ├── HashCodeCombiner.cs ├── HtmlAttributesStringParser.cs ├── HttpContextBaseExtensions.cs ├── IClientDependencyFile.cs ├── IClientDependencyFileExtensions.cs ├── IClientDependencyPath.cs ├── IClientDependencyPathExtensions.cs ├── IFileReader.cs ├── IHaveHtmlAttributes.cs ├── IHttpProvider.cs ├── IRequiresHtmlAttributesParsing.cs ├── JavascriptFile.cs ├── Logging │ ├── ILogger.cs │ ├── NullLogger.cs │ └── TraceLogger.cs ├── Module │ ├── ApplyingResponseFilterEventArgs.cs │ ├── ClientDependencyModule.cs │ ├── IFilter.cs │ ├── MimeTypeCompressor.cs │ ├── ResponseFilter.cs │ ├── ResponseFilterStream.cs │ └── RogueFileFilter.cs ├── NetworkHelper.cs ├── ObjectExtensions.cs ├── PathHelper.cs ├── PathsCollection.cs ├── PlaceholderParser.cs ├── PlaceholderReplacementEventArgs.cs ├── PlaceholdersReplacedEventArgs.cs ├── Properties │ └── AssemblyInfo.cs ├── ProviderDependencyList.cs ├── RendererOutput.cs ├── RequestHelper.cs ├── Resources │ └── LazyLoader.js ├── SimpleCompressor.cs ├── StringExtensions.cs ├── UriExtensions.cs ├── cdf.snk └── packages.config ├── ClientDependency.Less ├── CdfFileReader.cs ├── CdfPathResolver.cs ├── ClientDependency.Less.csproj ├── LessWriter.cs ├── Properties │ └── AssemblyInfo.cs ├── StartupHandler.cs ├── app.config └── packages.config ├── ClientDependency.Mvc ├── CdfRazorView.cs ├── CdfRazorViewEngine.cs ├── ClientDependency.Core.Mvc.csproj ├── DependencyRenderer.cs ├── DependencyRendererExtensions.cs ├── HtmlHelperExtensions.cs ├── MvcFilter.cs ├── MvcRogueFileFilter.cs ├── PlaceholderReplacer.cs ├── Properties │ └── AssemblyInfo.cs ├── ViewEnginesExtensions.cs ├── cdf.pub ├── cdf.snk └── packages.config ├── ClientDependency.SASS ├── ClientDependency.SASS.csproj ├── Properties │ └── AssemblyInfo.cs ├── SassHandler.cs ├── SassWriter.cs ├── StartupHandler.cs └── packages.config ├── ClientDependency.TypeScript ├── ClientDependency.TypeScript.csproj ├── JsLibs.Designer.cs ├── JsLibs.resx ├── Properties │ └── AssemblyInfo.cs ├── StartupHandler.cs ├── TypeScriptCompilationError.cs ├── TypeScriptCompilationErrorParser.cs ├── TypeScriptCompilationException.cs ├── TypeScriptHandler.cs ├── TypeScriptWriter.cs ├── compiler.js ├── lib.d.ts ├── packages.config └── typescript.min.js ├── ClientDependency.UnitTests ├── AllSections.config ├── App.config ├── BundleTests.cs ├── ClientDependency.UnitTests.csproj ├── ClientDependencySettingsTest.cs ├── CompositeFileProcessingProviderTest.cs ├── CssImportStatementsTest.cs ├── CssMinTest.cs ├── CssTransformTest.cs ├── FakeHttpContextFactory.cs ├── HtmlAttributesStringParserTest.cs ├── HtmlIncludeTests.cs ├── JsMinifyTest.cs ├── LegacyConfig1.3.config ├── MinSections.config ├── PathBasedUrlFormatValidatorTest.cs ├── Properties │ └── AssemblyInfo.cs ├── ResolveFilePathTest.cs ├── RogueFileFilterTest.cs ├── StringExtensionsTest.cs ├── TypeScriptTests.cs ├── cdf.snk └── packages.config ├── ClientDependency.Web.Test ├── ClientDependency.Web.Test.csproj ├── Controllers │ ├── HomeController.cs │ └── TestController.cs ├── Controls │ ├── Footer.ascx │ ├── Footer.ascx.cs │ ├── Footer.ascx.designer.cs │ ├── Header.ascx │ ├── Header.ascx.cs │ ├── Header.ascx.designer.cs │ ├── MyCustomControl.cs │ ├── Sidebar.ascx │ ├── Sidebar.ascx.cs │ └── Sidebar.ascx.designer.cs ├── Css │ ├── BundleTest │ │ ├── css1.css │ │ ├── css2.css │ │ └── css3.css │ ├── ColorScheme.css │ ├── Content.css │ ├── Controls.css │ ├── CustomControl.css │ ├── Default.css │ ├── Imports.css │ ├── Inuit │ │ ├── _testvars.scss │ │ ├── _vars.scss │ │ ├── inuit.css │ │ │ ├── _defaults.scss │ │ │ ├── _inuit.scss │ │ │ ├── base │ │ │ │ ├── _code.scss │ │ │ │ ├── _forms.scss │ │ │ │ ├── _headings.scss │ │ │ │ ├── _images.scss │ │ │ │ ├── _lists.scss │ │ │ │ ├── _main.scss │ │ │ │ ├── _paragraphs.scss │ │ │ │ ├── _quotes.scss │ │ │ │ ├── _smallprint.scss │ │ │ │ └── _tables.scss │ │ │ ├── generic │ │ │ │ ├── _brand.scss │ │ │ │ ├── _clearfix.scss │ │ │ │ ├── _debug.scss │ │ │ │ ├── _helper.scss │ │ │ │ ├── _mixins.scss │ │ │ │ ├── _normalize.scss │ │ │ │ ├── _pull.scss │ │ │ │ ├── _push.scss │ │ │ │ ├── _reset.scss │ │ │ │ ├── _shared.scss │ │ │ │ └── _widths.scss │ │ │ └── objects │ │ │ │ ├── _arrows.scss │ │ │ │ ├── _beautons.scss │ │ │ │ ├── _block-list.scss │ │ │ │ ├── _breadcrumb.scss │ │ │ │ ├── _columns.scss │ │ │ │ ├── _flexbox.scss │ │ │ │ ├── _flyout.scss │ │ │ │ ├── _greybox.scss │ │ │ │ ├── _grids.scss │ │ │ │ ├── _icon-text.scss │ │ │ │ ├── _island.scss │ │ │ │ ├── _link-complex.scss │ │ │ │ ├── _lozenges.scss │ │ │ │ ├── _marginalia.scss │ │ │ │ ├── _matrix.scss │ │ │ │ ├── _media.scss │ │ │ │ ├── _nav.scss │ │ │ │ ├── _options.scss │ │ │ │ ├── _pagination.scss │ │ │ │ ├── _rules.scss │ │ │ │ ├── _split.scss │ │ │ │ ├── _sprite.scss │ │ │ │ ├── _stats.scss │ │ │ │ └── _this-or-this.scss │ │ ├── style.scss │ │ └── test.scss │ ├── Libs │ │ └── bootstrap.min.css │ ├── MyFirstLess.css │ ├── MyFirstLess.less │ ├── MyFirstLess.min.css │ ├── MyFirstSass.sass │ ├── MyFirstScss.scss │ ├── OverrideStyles.css │ ├── Print.css │ ├── Site.css │ ├── SubFolder │ │ ├── testless2.less │ │ ├── testless3.less │ │ ├── testless4.css │ │ └── testless4.less │ ├── Test.css │ ├── TestPath │ │ └── BodyGradient.css │ ├── testless1.css │ └── testless1.less ├── Default.aspx ├── Default.aspx.cs ├── Default.aspx.designer.cs ├── Global.asax ├── Global.asax.cs ├── Images │ └── header.gif ├── Js │ ├── AnotherTest.js │ ├── EncodingTestANSI.js │ ├── EncodingTestUCS2BigEndian.js │ ├── EncodingTestUCS2LittleEndian.js │ ├── EncodingTestUTF8.js │ ├── EncodingTestUTF8WithoutBOM.js │ ├── FooterScript.js │ ├── HtmlIncludeTest1.js │ ├── HtmlIncludeTest2.js │ ├── JQueryTemplate.js │ ├── JsFromAspx.aspx │ ├── Libs │ │ ├── inputmask │ │ │ ├── inputmask.date.extensions.js │ │ │ ├── inputmask.dependencyLib.jquery.js │ │ │ ├── inputmask.extensions.js │ │ │ ├── inputmask.js │ │ │ ├── inputmask.numeric.extensions.js │ │ │ ├── inputmask.phone.extensions.js │ │ │ ├── inputmask.regex.extensions.js │ │ │ └── jquery.inputmask.js │ │ ├── inputmask_min │ │ │ ├── inputmask.date.extensions.min.js │ │ │ ├── inputmask.dependencyLib.jquery.min.js │ │ │ ├── inputmask.extensions.min.js │ │ │ ├── inputmask.min.js │ │ │ ├── inputmask.numeric.extensions.min.js │ │ │ ├── inputmask.phone.extensions.min.js │ │ │ ├── inputmask.regex.extensions.min.js │ │ │ └── jquery.inputmask.min.js │ │ └── jquery │ │ │ └── jquery-1.12.3.min.js │ ├── MessageService.js │ ├── MyFirstCoffee.coffee │ ├── MyFirstCoffee.js │ ├── MyFirstCoffee.min.js │ ├── MyFirstTypeScript.ts │ ├── RogueScript1.js │ ├── RogueScript2.js │ ├── SomeLazyLoadScript.js │ ├── TestPath │ │ └── HeaderOrange.js │ ├── jquery-1.3.2.min.js │ └── jquery-ui-1.8.13.custom.min.js ├── Models │ └── TestModel.cs ├── Pages │ ├── Default.aspx │ ├── Default.aspx.cs │ ├── Default.aspx.designer.cs │ ├── DependencyGroups.aspx │ ├── DependencyGroups.aspx.cs │ ├── DependencyGroups.aspx.designer.cs │ ├── EmbeddedResourceTest.aspx │ ├── EmbeddedResourceTest.aspx.cs │ ├── EmbeddedResourceTest.aspx.designer.cs │ ├── EncodingTest.aspx │ ├── EncodingTest.aspx.cs │ ├── EncodingTest.aspx.designer.cs │ ├── ForcedProviders.aspx │ ├── ForcedProviders.aspx.cs │ ├── ForcedProviders.aspx.designer.cs │ ├── HtmlAttributes.aspx │ ├── HtmlAttributes.aspx.cs │ ├── HtmlAttributes.aspx.designer.cs │ ├── HtmlIncludeTest.aspx │ ├── HtmlIncludeTest.aspx.cs │ ├── HtmlIncludeTest.aspx.designer.cs │ ├── JSONCompressionTest.aspx │ ├── JSONCompressionTest.aspx.cs │ ├── JSONCompressionTest.aspx.designer.cs │ ├── LazyLoadProvider.aspx │ ├── LazyLoadProvider.aspx.cs │ ├── LazyLoadProvider.aspx.designer.cs │ ├── LazyLoadProviderTest.aspx │ ├── LazyLoadProviderTest.aspx.cs │ ├── LazyLoadProviderTest.aspx.designer.cs │ ├── Master.Master │ ├── Master.Master.cs │ ├── Master.Master.designer.cs │ ├── RemoteDependencies.aspx │ ├── RemoteDependencies.aspx.cs │ ├── RemoteDependencies.aspx.designer.cs │ ├── RogueScriptDetectionTest.aspx │ ├── RogueScriptDetectionTest.aspx.cs │ ├── RogueScriptDetectionTest.aspx.designer.cs │ ├── embedded.css │ └── relative.css ├── Properties │ └── AssemblyInfo.cs ├── Services │ ├── MessageService.asmx │ └── MessageService.asmx.cs ├── TestLogger.cs ├── Views │ ├── Shared │ │ ├── CustomControl.ascx │ │ ├── Footer.ascx │ │ ├── Header.ascx │ │ ├── Master.cshtml │ │ ├── SideBar.ascx │ │ └── Site.Master │ ├── Test │ │ ├── Bundles.cshtml │ │ ├── Coffee.cshtml │ │ ├── Default.cshtml │ │ ├── DynamicPathRegistration.aspx │ │ ├── Folder.cshtml │ │ ├── ForcedProvider.cshtml │ │ ├── FromAspx.cshtml │ │ ├── Groups.cshtml │ │ ├── HtmlAttributes.aspx │ │ ├── ImportsCss.cshtml │ │ ├── Inuit.cshtml │ │ ├── Less.cshtml │ │ ├── RemoteDependencies.aspx │ │ ├── RogueDependencies.aspx │ │ ├── Sass.cshtml │ │ └── TypeScript.cshtml │ └── Web.config ├── Web.config └── packages.config ├── ClientDependency.sln ├── DLLs └── umbraco.dll ├── SolutionInfo.cs └── Umbraco4.ClientDependency ├── CanvasClientDependencyProvider.cs ├── Properties └── AssemblyInfo.cs └── Umbraco4.ClientDependency.csproj /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [shazwazza] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /appveyor.build.yml: -------------------------------------------------------------------------------- 1 | version: 1.9.10.{build} 2 | skip_tags: true 3 | image: Visual Studio 2019 4 | build_script: 5 | - ps: .\Build-Release.ps1 $env:APPVEYOR_BUILD_VERSION '' 1 6 | artifacts: 7 | - path: build\Release\*.nupkg 8 | name: Nuget Package -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.9.10 2 | skip_non_tags: true 3 | image: Visual Studio 2019 4 | build_script: 5 | - ps: .\build\build.ps1 1 6 | artifacts: 7 | - path: build\Release\*.nupkg 8 | name: Nuget Package 9 | -------------------------------------------------------------------------------- /assets/ClientDependencyLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/assets/ClientDependencyLogo.png -------------------------------------------------------------------------------- /build/ClientDependency-Coffee.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ClientDependency-Coffee 5 | Client Dependency Framework for CoffeeScript 6 | 0.0.0.0 7 | Shannon Deminick 8 | An extension for the ClientDependency framework to support Coffee Script 9 | ClientDependency for Coffee Script 10 | en-US 11 | http://www.opensource.org/licenses/ms-pl 12 | https://github.com/Shandem/ClientDependency 13 | CoffeeScript coffee script javascript js html clientdependency cdf minify compress combine 14 | false 15 | Copyright © Shannon Deminick $copyrightyear$ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /build/ClientDependency-Less.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ClientDependency-Less 5 | Client Dependency Framework for .Less 6 | 0.0.0.0 7 | Shannon Deminick 8 | An extension for the ClientDependency framework to support .Less (dotless) 9 | ClientDependency for .Less (dotless) 10 | en-US 11 | http://www.opensource.org/licenses/ms-pl 12 | https://github.com/Shandem/ClientDependency 13 | .less dotless css html clientdependency cdf minification minify compress combine 14 | false 15 | Copyright © Shannon Deminick $copyrightyear$ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /build/ClientDependency-Mvc.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ClientDependency-Mvc 5 | Client Dependency Framework for MVC 6 | 0.0.0.0 7 | Shannon Deminick 8 | An extension for the ClientDependency framework to support ASP.NET MVC. 9 | ClientDependency for MVC 10 | en-US 11 | http://www.opensource.org/licenses/ms-pl 12 | https://github.com/Shandem/ClientDependency 13 | mvc css html javascript clientdependency cdf minify compress combine 14 | false 15 | Copyright © Shannon Deminick $copyrightyear$ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /build/ClientDependency-Mvc5.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ClientDependency-Mvc5 5 | Client Dependency Framework for MVC 5 6 | 0.0.0.0 7 | Shannon Deminick 8 | An extension for the ClientDependency framework to support ASP.NET MVC 5. 9 | ClientDependency for MVC 5 10 | en-US 11 | http://www.opensource.org/licenses/ms-pl 12 | https://github.com/Shandem/ClientDependency 13 | mvc css html javascript clientdependency cdf minify compress combine 14 | false 15 | Copyright © Shannon Deminick $copyrightyear$ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /build/ClientDependency-SASS.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ClientDependency-SASS 5 | Client Dependency Framework for SASS 6 | 0.0.0.0 7 | Shannon Deminick 8 | An extension for the ClientDependency framework to support SASS 9 | ClientDependency for SASS 10 | en-US 11 | http://www.opensource.org/licenses/ms-pl 12 | https://github.com/Shandem/ClientDependency 13 | SASS scss css html clientdependency cdf minify compress combine 14 | false 15 | Copyright © Shannon Deminick $copyrightyear$ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /build/ClientDependency-TypeScript.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ClientDependency-TypeScript 5 | Client Dependency Framework for TypeScript 6 | 0.0.0.0 7 | Shannon Deminick 8 | An extension for the ClientDependency framework to support TypeScript 9 | ClientDependency for TypeScript 10 | en-US 11 | http://www.opensource.org/licenses/ms-pl 12 | https://github.com/Shandem/ClientDependency 13 | typescript type script javascript js html clientdependency cdf minify compress combine 14 | false 15 | Copyright © Shannon Deminick $copyrightyear$ 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /build/nuget-transforms/Coffee/web.config.transform: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/nuget-transforms/Less/web.config.transform: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | -------------------------------------------------------------------------------- /build/nuget-transforms/Mvc/web.config.transform: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/nuget-transforms/SASS/web.config.transform: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /build/nuget-transforms/TypeScript/web.config.transform: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ClientDependency.Coffee/CoffeeHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | using ClientDependency.Core; 7 | 8 | namespace ClientDependency.Coffee 9 | { 10 | /// 11 | /// An http handler for .coffee extensions which is used when in debug mode 12 | /// 13 | public class CoffeeHandler : IHttpHandler 14 | { 15 | public void ProcessRequest(HttpContext context) 16 | { 17 | var localPath = context.Request.Url.LocalPath; 18 | if (string.IsNullOrEmpty(localPath)) return; 19 | var reader = new VirtualPathFileReader(); 20 | var fileContents = reader.ReadFile(localPath); 21 | var writer = new CoffeeWriter(); 22 | var output = writer.GetOutput(fileContents); 23 | context.Response.ContentType = "text/javascript"; 24 | context.Response.Write(output); 25 | } 26 | 27 | public bool IsReusable 28 | { 29 | get { return false; } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/ClientDependency.Coffee/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClientDependency.Coffee")] 9 | [assembly: AssemblyDescription("An extension for the ClientDependency framework to support Coffee Script")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyProduct("ClientDependency.Coffee")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("6a35904f-545f-4289-bbb8-d41de75f9477")] -------------------------------------------------------------------------------- /src/ClientDependency.Coffee/StartupHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using ClientDependency.Coffee; 3 | using ClientDependency.Core; 4 | 5 | [assembly: PreApplicationStartMethod(typeof(StartupHandler), "Initialize")] 6 | 7 | namespace ClientDependency.Coffee 8 | { 9 | /// 10 | /// Class called to register the less writer 11 | /// 12 | public static class StartupHandler 13 | { 14 | public static void Initialize() 15 | { 16 | //register the less writer. 17 | FileWriters.AddWriterForExtension(".coffee", new CoffeeWriter()); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ClientDependency.Coffee/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/BasicPath.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | using System.Web.UI; 7 | 8 | namespace ClientDependency.Core 9 | { 10 | public class BasicPath : IClientDependencyPath 11 | { 12 | public BasicPath() { } 13 | public BasicPath(string name, string path) 14 | { 15 | if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); 16 | if (string.IsNullOrEmpty(path)) throw new ArgumentNullException("path"); 17 | Name = name; 18 | Path = path; 19 | } 20 | 21 | public string Name { get; set; } 22 | public string Path { get; set; } 23 | public bool ForceBundle { get; set; } 24 | 25 | protected bool Equals(BasicPath other) 26 | { 27 | return string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase) 28 | && string.Equals(Path, other.Path, StringComparison.InvariantCultureIgnoreCase); 29 | } 30 | 31 | public override bool Equals(object obj) 32 | { 33 | if (ReferenceEquals(null, obj)) return false; 34 | if (ReferenceEquals(this, obj)) return true; 35 | if (obj.GetType() != this.GetType()) return false; 36 | return Equals((BasicPath) obj); 37 | } 38 | 39 | public override int GetHashCode() 40 | { 41 | unchecked 42 | { 43 | return (Name.GetHashCode()*397) ^ Path.GetHashCode(); 44 | } 45 | } 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/BundleDefinition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ClientDependency.Core 4 | { 5 | 6 | /// 7 | /// Defines all information relating to a pre-defined bundle 8 | /// 9 | internal class BundleDefinition 10 | { 11 | public BundleDefinition( 12 | ClientDependencyType type, 13 | string name) 14 | { 15 | if (name == null) throw new ArgumentNullException("name"); 16 | Type = type; 17 | Name = name; 18 | } 19 | 20 | public ClientDependencyType Type { get; private set; } 21 | public string Name { get; private set; } 22 | 23 | protected bool Equals(BundleDefinition other) 24 | { 25 | return Type == other.Type && string.Equals(Name, other.Name); 26 | } 27 | 28 | public override bool Equals(object obj) 29 | { 30 | if (ReferenceEquals(null, obj)) return false; 31 | if (ReferenceEquals(this, obj)) return true; 32 | if (obj.GetType() != this.GetType()) return false; 33 | return Equals((BundleDefinition) obj); 34 | } 35 | 36 | public override int GetHashCode() 37 | { 38 | unchecked 39 | { 40 | return ((int) Type*397) ^ Name.GetHashCode(); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/BundleResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ClientDependency.Core 4 | { 5 | /// 6 | /// Is returned when resolving a bundle 7 | /// 8 | internal class BundleResult 9 | { 10 | public BundleDefinition Definition { get; set; } 11 | public IEnumerable Files { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/ClientDependencyType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ClientDependency.Core 6 | { 7 | /// 8 | /// The type of client file 9 | /// 10 | public enum ClientDependencyType 11 | { 12 | Javascript, Css 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/CSSMin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace ClientDependency.Core.CompositeFiles 8 | { 9 | [Obsolete("Use CssHelper instead")] 10 | public class CssMin 11 | { 12 | public static string CompressCSS(string body) 13 | { 14 | return CssHelper.MinifyCss(body); 15 | } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/CompositeFileDefinition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ClientDependency.Core.Config; 6 | using System.IO; 7 | using System.Web; 8 | using System.Net; 9 | using System.IO.Compression; 10 | 11 | namespace ClientDependency.Core.CompositeFiles 12 | { 13 | /// 14 | /// A simple class defining a Uri string and whether or not it is a local application file 15 | /// 16 | public class CompositeFileDefinition 17 | { 18 | public CompositeFileDefinition(string uri, bool isLocalFile) 19 | { 20 | IsLocalFile = isLocalFile; 21 | Uri = uri; 22 | } 23 | public bool IsLocalFile { get; set; } 24 | public string Uri { get; set; } 25 | 26 | public override bool Equals(object obj) 27 | { 28 | return (obj.GetType() == this.GetType() 29 | && ((CompositeFileDefinition)obj).IsLocalFile.Equals(IsLocalFile) 30 | && ((CompositeFileDefinition)obj).Uri.Equals(Uri)); 31 | } 32 | 33 | /// 34 | /// overrides hash code to ensure that it is unique per machine 35 | /// 36 | /// 37 | public override int GetHashCode() 38 | { 39 | return (NetworkHelper.MachineName + Uri).GetHashCode(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/CompressionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ClientDependency.Core.Config; 6 | using System.IO; 7 | using System.Web; 8 | using System.Net; 9 | using System.IO.Compression; 10 | 11 | namespace ClientDependency.Core.CompositeFiles 12 | { 13 | public enum CompressionType 14 | { 15 | deflate, gzip, none 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/IFileWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Web; 3 | using ClientDependency.Core.CompositeFiles.Providers; 4 | 5 | namespace ClientDependency.Core.CompositeFiles 6 | { 7 | /// 8 | /// An interface defining a file writer for a local file 9 | /// 10 | public interface IFileWriter 11 | { 12 | /// 13 | /// writes the file to the stream and returns true if it was successful, false if not successful 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | bool WriteToStream(BaseCompositeFileProcessingProvider provider, StreamWriter sw, FileInfo fi, ClientDependencyType type, string origUrl, HttpContextBase http); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/IVirtualFile.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace ClientDependency.Core.CompositeFiles 4 | { 5 | public interface IVirtualFile 6 | { 7 | string Path { get; } 8 | Stream Open(); 9 | } 10 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/IVirtualFileProvider.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core.CompositeFiles 2 | { 3 | public interface IVirtualFileProvider 4 | { 5 | bool FileExists(string virtualPath); 6 | IVirtualFile GetFile(string virtualPath); 7 | } 8 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/IVirtualFileWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Web; 3 | using System.Web.Hosting; 4 | using ClientDependency.Core.CompositeFiles.Providers; 5 | 6 | namespace ClientDependency.Core.CompositeFiles 7 | { 8 | public interface IVirtualFileWriter 9 | { 10 | IVirtualFileProvider FileProvider { get; } 11 | 12 | /// 13 | /// writes the file to the stream and returns true if it was successful, false if not successful 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | bool WriteToStream(BaseCompositeFileProcessingProvider provider, StreamWriter sw, IVirtualFile vf, ClientDependencyType type, string origUrl, HttpContextBase http); 23 | } 24 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/Providers/CompositeFileProcessingProviderCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Configuration.Provider; 5 | 6 | namespace ClientDependency.Core.CompositeFiles.Providers 7 | { 8 | public class CompositeFileProcessingProviderCollection : ProviderCollection 9 | { 10 | public new BaseCompositeFileProcessingProvider this[string name] 11 | { 12 | get { return (BaseCompositeFileProcessingProvider)base[name]; } 13 | } 14 | 15 | public override void Add(ProviderBase provider) 16 | { 17 | if (provider == null) 18 | throw new ArgumentNullException("provider"); 19 | 20 | if (!(provider is BaseCompositeFileProcessingProvider)) 21 | throw new ArgumentException("Invalid provider type", "provider"); 22 | 23 | base.Add(provider); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/Providers/CompositeUrlType.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core.CompositeFiles.Providers 2 | { 3 | public enum CompositeUrlType 4 | { 5 | /// 6 | /// The original URL type in which full dependency paths are base64 encoded as query strings 7 | /// 8 | Base64QueryStrings, 9 | 10 | /// 11 | /// Creates a URL in which the full dependency paths are base64 encoded as URL paths, however because 12 | /// paths can get quite large, this requires that .Net 4 is running and that you increase the maxUrlLength 13 | /// configuration property in the httpRuntime section in your web.config 14 | /// 15 | Base64Paths, 16 | 17 | /// 18 | /// Uses the file map provider to store and map the dependency paths with a reference to an ID it generates 19 | /// 20 | MappedId 21 | } 22 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompositeFiles/Providers/FileMapProviderCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration.Provider; 3 | 4 | namespace ClientDependency.Core.CompositeFiles.Providers 5 | { 6 | public class FileMapProviderCollection : ProviderCollection 7 | { 8 | public new BaseFileMapProvider this[string name] 9 | { 10 | get { return (BaseFileMapProvider)base[name]; } 11 | } 12 | 13 | public override void Add(ProviderBase provider) 14 | { 15 | if (provider == null) 16 | throw new ArgumentNullException("provider"); 17 | 18 | if (!(provider is BaseFileMapProvider)) 19 | throw new ArgumentException("Invalid provider type", "provider"); 20 | 21 | base.Add(provider); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/CompressionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ClientDependency.Core.Config; 6 | using System.IO; 7 | using System.Web; 8 | using System.Net; 9 | using System.IO.Compression; 10 | 11 | namespace ClientDependency.Core 12 | { 13 | public enum CompressionType 14 | { 15 | deflate, gzip, none 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Config/ConfigurationManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | using System.Web.Configuration; 7 | 8 | namespace ClientDependency.Core.Config 9 | { 10 | public static class ConfigurationHelper 11 | { 12 | 13 | public static bool IsCompilationDebug 14 | { 15 | get 16 | { 17 | CompilationSection compilation = ConfigurationManager.GetSection("system.web/compilation") as CompilationSection; 18 | if (compilation != null) 19 | { 20 | return compilation.Debug; 21 | } 22 | return false; //by default, return false! 23 | } 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Config/MimeTypeCompressionCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | 7 | namespace ClientDependency.Core.Config 8 | { 9 | 10 | 11 | public class MimeTypeCompressionCollection : ConfigurationElementCollection 12 | { 13 | protected override bool ThrowOnDuplicate 14 | { 15 | get 16 | { 17 | return true; 18 | } 19 | } 20 | 21 | protected override ConfigurationElement CreateNewElement() 22 | { 23 | var e = new MimeTypeCompressionElement(); 24 | return e; 25 | } 26 | 27 | protected override object GetElementKey(ConfigurationElement element) 28 | { 29 | return ((MimeTypeCompressionElement)element); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Config/MimeTypeCompressionElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | 7 | namespace ClientDependency.Core.Config 8 | { 9 | public class MimeTypeCompressionElement : ConfigurationElement 10 | { 11 | [ConfigurationProperty("type", IsRequired = true)] 12 | public string MimeType 13 | { 14 | get 15 | { 16 | return (string)this["type"]; 17 | } 18 | } 19 | 20 | [ConfigurationProperty("path", DefaultValue = "*")] 21 | public string FilePath 22 | { 23 | get 24 | { 25 | return (string)this["path"]; 26 | } 27 | } 28 | 29 | public override int GetHashCode() 30 | { 31 | return (this.MimeType + this.FilePath).GetHashCode(); 32 | } 33 | 34 | public override bool Equals(object compareTo) 35 | { 36 | var e = compareTo as MimeTypeCompressionElement; 37 | if (e != null) 38 | { 39 | return (e.GetHashCode().Equals(this.GetHashCode())); 40 | } 41 | return false; 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Config/MvcSection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | 7 | namespace ClientDependency.Core.Config 8 | { 9 | public class MvcSection : ConfigurationElement 10 | { 11 | 12 | [ConfigurationProperty("renderers")] 13 | public ProviderSettingsCollection Renderers 14 | { 15 | get { return (ProviderSettingsCollection)base["renderers"]; } 16 | } 17 | 18 | [StringValidator(MinLength = 1)] 19 | [ConfigurationProperty("defaultRenderer", DefaultValue = "StandardRenderer")] 20 | public string DefaultRenderer 21 | { 22 | get { return (string)base["defaultRenderer"]; } 23 | set { base["defaultRenderer"] = value; } 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Config/RogueFileCompressionCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | 7 | namespace ClientDependency.Core.Config 8 | { 9 | public class RogueFileCompressionCollection : ConfigurationElementCollection 10 | { 11 | protected override bool ThrowOnDuplicate 12 | { 13 | get 14 | { 15 | return true; 16 | } 17 | } 18 | 19 | protected override ConfigurationElement CreateNewElement() 20 | { 21 | var e = new RogueFileCompressionElement(); 22 | return e; 23 | } 24 | 25 | protected override object GetElementKey(ConfigurationElement element) 26 | { 27 | return ((RogueFileCompressionElement)element); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Config/RogueFileCompressionExcludeCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | 7 | namespace ClientDependency.Core.Config 8 | { 9 | public class RogueFileCompressionExcludeCollection : ConfigurationElementCollection 10 | { 11 | protected override bool ThrowOnDuplicate 12 | { 13 | get 14 | { 15 | return true; 16 | } 17 | } 18 | 19 | protected override ConfigurationElement CreateNewElement() 20 | { 21 | var e = new RogueFileCompressionExcludeElement(); 22 | return e; 23 | } 24 | 25 | protected override object GetElementKey(ConfigurationElement element) 26 | { 27 | return ((RogueFileCompressionExcludeElement)element); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Config/RogueFileCompressionExcludeElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | 7 | namespace ClientDependency.Core.Config 8 | { 9 | 10 | public class RogueFileCompressionExcludeElement : ConfigurationElement 11 | { 12 | [ConfigurationProperty("path", IsRequired = true)] 13 | public string FilePath 14 | { 15 | get 16 | { 17 | return (string)this["path"]; 18 | } 19 | } 20 | 21 | public override int GetHashCode() 22 | { 23 | return this.FilePath.GetHashCode(); 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core 2 | { 3 | public static class Constants 4 | { 5 | /// 6 | /// If a priority is not set, the default will be 100. 7 | /// 8 | /// 9 | /// This will generally mean that if a developer doesn't specify a priority it will come after all other dependencies that 10 | /// have unless the priority is explicitly set above 100. 11 | /// 12 | public const int DefaultPriority = 100; 13 | 14 | /// 15 | /// If a group is not set, the default will be 100. 16 | /// 17 | /// 18 | /// Unless a group is specified, all dependencies will go into the same, default, group. 19 | /// 20 | public const int DefaultGroup = 100; 21 | } 22 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/ControlExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.UI; 6 | using ClientDependency.Core.Controls; 7 | using System.Web; 8 | 9 | namespace ClientDependency.Core 10 | { 11 | public static class ControlExtensions 12 | { 13 | 14 | public static IEnumerable FlattenChildren(this Control control) 15 | { 16 | var children = control.Controls.Cast().ToArray(); 17 | return children.SelectMany(FlattenChildren).Concat(children); 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Controls/ClientDependencyPathCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ClientDependency.Core.Controls 6 | { 7 | public class ClientDependencyPathCollection : List 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Controls/CssFolderInclude.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core.Controls 2 | { 3 | /// 4 | /// A control used to specify a Css folder dependency 5 | /// 6 | public class CssFolderInclude : DependencyFolderInclude 7 | { 8 | private const string SearchPattern = "*.css"; 9 | 10 | public CssFolderInclude() : base() 11 | { 12 | FileSearchPattern = SearchPattern; 13 | } 14 | 15 | public CssFolderInclude(string folderVirtualPath) : base(folderVirtualPath) 16 | { 17 | FileSearchPattern = SearchPattern; 18 | } 19 | 20 | protected override ClientDependencyType DependencyType 21 | { 22 | get { return ClientDependencyType.Css; } 23 | } 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/Controls/CssInclude.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Text; 4 | 5 | namespace ClientDependency.Core.Controls 6 | { 7 | /// 8 | /// A control used to add a Css file dependency 9 | /// 10 | public class CssInclude : ClientDependencyInclude 11 | { 12 | private CssMediaType _cssMedia; 13 | internal bool EncodeImages { get; set; } 14 | 15 | public CssInclude() 16 | { 17 | DependencyType = ClientDependencyType.Css; 18 | CssMedia = CssMediaType.All; 19 | } 20 | public CssInclude(IClientDependencyFile file) 21 | : base(file) 22 | { 23 | DependencyType = ClientDependencyType.Css; 24 | CssMedia = CssMediaType.All; 25 | } 26 | public CssInclude(IClientDependencyFile file, CssMediaType mediaType) 27 | : base(file) 28 | { 29 | DependencyType = ClientDependencyType.Css; 30 | CssMedia = mediaType; 31 | } 32 | 33 | public CssMediaType CssMedia 34 | { 35 | get { return _cssMedia; } 36 | set 37 | { 38 | if (value != CssMediaType.All) 39 | { 40 | HtmlAttributes.Remove("media"); 41 | HtmlAttributes.Remove("Media"); 42 | HtmlAttributes["media"] = value.ToString().ToLowerInvariant(); 43 | } 44 | _cssMedia = value; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Controls/JsFolderInclude.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core.Controls 2 | { 3 | /// 4 | /// A control used to specify a Js folder dependency 5 | /// 6 | public class JsFolderInclude : DependencyFolderInclude 7 | { 8 | private const string SearchPattern = "*.js"; 9 | 10 | public JsFolderInclude() 11 | { 12 | FileSearchPattern = SearchPattern; 13 | } 14 | 15 | public JsFolderInclude(string folderVirtualPath) 16 | : base(folderVirtualPath) 17 | { 18 | FileSearchPattern = SearchPattern; 19 | } 20 | 21 | protected override ClientDependencyType DependencyType 22 | { 23 | get { return ClientDependencyType.Javascript; } 24 | } 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/Controls/JsInclude.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core.Controls 2 | { 3 | public class JsInclude : ClientDependencyInclude 4 | { 5 | public JsInclude() 6 | { 7 | DependencyType = ClientDependencyType.Javascript; 8 | } 9 | 10 | public JsInclude(IClientDependencyFile file) 11 | : base(file) 12 | { 13 | DependencyType = ClientDependencyType.Javascript; 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CssFile.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core 2 | { 3 | /// 4 | /// Represents a CSS file 5 | /// 6 | public class CssFile : BasicFile 7 | { 8 | public CssFile(string filePath) 9 | : base(ClientDependencyType.Css) 10 | { 11 | FilePath = filePath; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/CssFileUrlFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Text; 5 | using ClientDependency.Core.Config; 6 | 7 | namespace ClientDependency.Core 8 | { 9 | [Obsolete("Use CssHelper instead")] 10 | public class CssFileUrlFormatter 11 | { 12 | public static string TransformCssFile(string fileContent, Uri cssLocation) 13 | { 14 | return CssHelper.ReplaceUrlsWithAbsolutePaths(fileContent, cssLocation); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/CssMediaType.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core 2 | { 3 | public enum CssMediaType 4 | { 5 | All, Screen, Print 6 | } 7 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/DependencyHtmlElement.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ClientDependency.Core 4 | { 5 | /// 6 | /// A simple model defining the source of the dependency and the Html Elements that need to be rendered as part of the html tag 7 | /// 8 | public class DependencyHtmlElement 9 | { 10 | public string Source { get; set; } 11 | public IDictionary HtmlAttributes { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/DictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace ClientDependency.Core 6 | { 7 | public static class DictionaryExtensions 8 | { 9 | 10 | /// 11 | /// Returns the dictionary as formatted html attributes for use in an html tag 12 | /// 13 | /// 14 | /// 15 | public static string ToHtmlAttributes(this IDictionary d) 16 | { 17 | return string.Join(" ", d.Select(x => x.Key + "=\"" + x.Value + "\"").ToArray()); 18 | } 19 | 20 | /// 21 | /// Determines if 2 dictionaries contain the exact same keys/values 22 | /// 23 | /// 24 | /// 25 | /// 26 | public static bool IsEqualTo(this IDictionary d, IDictionary compareTo) 27 | { 28 | if (d.Count != compareTo.Count) 29 | return false; 30 | 31 | foreach(var i in d) 32 | { 33 | if (!compareTo.ContainsKey(i.Key)) 34 | return false; 35 | if (!compareTo[i.Key].Equals(i.Value, StringComparison.InvariantCultureIgnoreCase)) 36 | return false; 37 | } 38 | 39 | return true; 40 | } 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/FileRegistration/Providers/BaseRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration.Provider; 6 | using ClientDependency.Core.Config; 7 | using ClientDependency.Core.FileRegistration.Providers; 8 | using System.IO; 9 | using System.Web; 10 | 11 | namespace ClientDependency.Core.FileRegistration.Providers 12 | { 13 | 14 | public abstract class BaseRenderer : BaseFileRegistrationProvider 15 | { 16 | public virtual void RegisterDependencies(List allDependencies, 17 | HashSet paths, 18 | out string jsOutput, 19 | out string cssOutput, 20 | HttpContextBase http) 21 | { 22 | WriteDependencies(allDependencies, paths, out jsOutput, out cssOutput, http); 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/FileRegistration/Providers/FileRegistrationProviderCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Configuration.Provider; 5 | 6 | namespace ClientDependency.Core.FileRegistration.Providers 7 | { 8 | public class FileRegistrationProviderCollection : ProviderCollection 9 | { 10 | public new WebFormsFileRegistrationProvider this[string name] 11 | { 12 | get { return (WebFormsFileRegistrationProvider)base[name]; } 13 | } 14 | 15 | public override void Add(ProviderBase provider) 16 | { 17 | if (provider == null) 18 | throw new ArgumentNullException("provider"); 19 | 20 | if (!(provider is WebFormsFileRegistrationProvider)) 21 | throw new ArgumentException("Invalid provider type", "provider"); 22 | 23 | base.Add(provider); 24 | } 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/FileRegistration/Providers/HtmlEmbedContants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ClientDependency.Core.FileRegistration.Providers 7 | { 8 | public class HtmlEmbedContants 9 | { 10 | public const string ScriptEmbedWithSource = ""; 11 | public const string CssEmbedWithSource = ""; 12 | 13 | public const string ScriptEmbedWithCode = ""; 14 | //public const string CssEmbed = ""; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/FileRegistration/Providers/RendererCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration.Provider; 6 | 7 | namespace ClientDependency.Core.FileRegistration.Providers 8 | { 9 | public class RendererCollection : ProviderCollection 10 | { 11 | public new BaseRenderer this[string name] 12 | { 13 | get { return (BaseRenderer)base[name]; } 14 | } 15 | 16 | public override void Add(ProviderBase provider) 17 | { 18 | if (provider == null) 19 | throw new ArgumentNullException("provider"); 20 | 21 | if (!(provider is BaseRenderer)) 22 | throw new ArgumentException("Invalid provider type", "provider"); 23 | 24 | base.Add(provider); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/IClientDependencyFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ClientDependency.Core 6 | { 7 | public interface IClientDependencyFile 8 | { 9 | string FilePath { get; set; } 10 | ClientDependencyType DependencyType { get; } 11 | int Priority { get; set; } 12 | int Group { get; set; } 13 | string PathNameAlias { get; set; } 14 | string ForceProvider { get; set; } 15 | bool ForceBundle { get; set; } 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/IClientDependencyPath.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ClientDependency.Core 7 | { 8 | public interface IClientDependencyPath 9 | { 10 | 11 | string Name { get; set; } 12 | string Path { get; set; } 13 | bool ForceBundle { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/IClientDependencyPathExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | 7 | namespace ClientDependency.Core 8 | { 9 | public static class ClientDependencyPathExtensions 10 | { 11 | 12 | public static string ResolvePath(this IClientDependencyPath path, HttpContextBase http) 13 | { 14 | if (string.IsNullOrEmpty(path.Path)) 15 | { 16 | throw new ArgumentException("The Path specified is null", "Path"); 17 | } 18 | if (path.Path.StartsWith("~/")) 19 | { 20 | return http.ResolveUrl(path.Path); 21 | } 22 | return path.Path; 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/IHaveHtmlAttributes.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ClientDependency.Core 4 | { 5 | /// 6 | /// interface defining that an object has Html attributes 7 | /// 8 | public interface IHaveHtmlAttributes 9 | { 10 | 11 | /// 12 | /// Used to store additional attributes in the HTML markup for the item 13 | /// 14 | /// 15 | /// Mostly used for CSS Media, but could be for anything 16 | /// 17 | IDictionary HtmlAttributes { get; } 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/IHttpProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | 7 | namespace ClientDependency.Core 8 | { 9 | /// 10 | /// A provider that requires initialization under an Http context. 11 | /// The Http initialization will happen after the standard provider initialization. 12 | /// 13 | public interface IHttpProvider 14 | { 15 | 16 | void Initialize(HttpContextBase http); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/IRequiresHtmlAttributesParsing.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core 2 | { 3 | /// 4 | /// interface defining that an IClientDependencyFile has html attributes applied as a string which require parsing 5 | /// 6 | public interface IRequiresHtmlAttributesParsing : IHaveHtmlAttributes 7 | { 8 | /// 9 | /// Used to set the HtmlAttributes on this class via a string which is parsed 10 | /// 11 | /// 12 | /// The syntax for the string must be: key1:value1,key2:value2 etc... 13 | /// 14 | string HtmlAttributesAsString { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/JavascriptFile.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core 2 | { 3 | /// 4 | /// Represents a JS file 5 | /// 6 | public class JavascriptFile : BasicFile 7 | { 8 | public JavascriptFile(string filePath) 9 | : base(ClientDependencyType.Javascript) 10 | { 11 | FilePath = filePath; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/Logging/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration.Provider; 6 | 7 | namespace ClientDependency.Core.Logging 8 | { 9 | public interface ILogger 10 | { 11 | void Debug(string msg); 12 | void Info(string msg); 13 | void Warn(string msg); 14 | void Error(string msg, Exception ex); 15 | void Fatal(string msg, Exception ex); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Logging/NullLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace ClientDependency.Core.Logging 7 | { 8 | internal class NullLogger : ILogger 9 | { 10 | #region ILogger Members 11 | 12 | public void Debug(string msg) 13 | { 14 | } 15 | 16 | public void Info(string msg) 17 | { 18 | } 19 | 20 | public void Warn(string msg) 21 | { 22 | } 23 | 24 | public void Error(string msg, Exception ex) 25 | { 26 | } 27 | 28 | public void Fatal(string msg, Exception ex) 29 | { 30 | } 31 | 32 | #endregion 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/Logging/TraceLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | 4 | namespace ClientDependency.Core.Logging 5 | { 6 | internal class TraceLogger : ILogger 7 | { 8 | private HttpContextBase GetHttpContext() 9 | { 10 | if (HttpContext.Current == null) 11 | return null; 12 | return new HttpContextWrapper(HttpContext.Current); 13 | } 14 | 15 | private void Trace(string msg, bool isWarn = false, string category = "ClientDependency") 16 | { 17 | var http = GetHttpContext(); 18 | if (http == null) return; 19 | if (isWarn) 20 | { 21 | http.Trace.Warn(category, msg); 22 | } 23 | else 24 | { 25 | http.Trace.Write(category, msg); 26 | } 27 | } 28 | 29 | public void Debug(string msg) 30 | { 31 | Trace(msg); 32 | } 33 | 34 | public void Info(string msg) 35 | { 36 | Trace(msg); 37 | } 38 | 39 | public void Warn(string msg) 40 | { 41 | Trace(msg, true); 42 | } 43 | 44 | public void Error(string msg, Exception ex) 45 | { 46 | Trace(msg, true); 47 | } 48 | 49 | public void Fatal(string msg, Exception ex) 50 | { 51 | Trace(msg, true); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/Module/ApplyingResponseFilterEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Web; 3 | 4 | namespace ClientDependency.Core.Module 5 | { 6 | public class ApplyingResponseFilterEventArgs : CancelEventArgs 7 | { 8 | public HttpContextBase HttpContext { get; private set; } 9 | 10 | public ApplyingResponseFilterEventArgs(HttpContextBase httpContext) 11 | { 12 | HttpContext = httpContext; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/Module/IFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | 7 | namespace ClientDependency.Core.Module 8 | { 9 | public interface IFilter 10 | { 11 | void SetHttpContext(HttpContextBase ctx); 12 | string UpdateOutputHtml(string html); 13 | HttpContextBase CurrentContext { get; } 14 | bool CanExecute(); 15 | bool ValidateCurrentHandler(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/ObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | 5 | namespace ClientDependency.Core 6 | { 7 | public static class ObjectExtensions 8 | { 9 | public static IDictionary ToDictionary(this object o) 10 | { 11 | var asObjectDictionary = o as IDictionary; 12 | if (asObjectDictionary != null) 13 | return asObjectDictionary; 14 | var asStringDictionary = o as IDictionary; 15 | if (asStringDictionary != null) 16 | return asStringDictionary.ToDictionary(x => x.Key, x => (object) x.Value); 17 | 18 | if (o != null) 19 | { 20 | var props = TypeDescriptor.GetProperties(o); 21 | var d = new Dictionary(); 22 | foreach (var prop in props.Cast()) 23 | { 24 | var val = prop.GetValue(o); 25 | if (val != null) 26 | { 27 | d.Add(prop.Name, val); 28 | } 29 | } 30 | return d; 31 | } 32 | return new Dictionary(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/PathHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Web; 4 | 5 | namespace ClientDependency.Core 6 | { 7 | internal class PathHelper 8 | { 9 | public static bool TryGetFileExtension(string filePath, out string extension) 10 | { 11 | try 12 | { 13 | extension = Path.GetExtension(filePath); 14 | return true; 15 | } 16 | catch (ArgumentException) 17 | { 18 | extension = null; 19 | return false; 20 | } 21 | } 22 | 23 | public static bool TryGetFileInfo(string path, HttpContextBase http, out FileInfo fileInfo) 24 | { 25 | if (!TryMapPath(path, http, out var mapped)) 26 | { 27 | fileInfo = null; 28 | return false; 29 | } 30 | 31 | try 32 | { 33 | fileInfo = new FileInfo(mapped); 34 | return fileInfo.Exists; 35 | } 36 | catch (Exception) 37 | { 38 | fileInfo = null; 39 | return false; 40 | } 41 | } 42 | 43 | public static bool TryMapPath(string path, HttpContextBase http, out string mappedPath) 44 | { 45 | try 46 | { 47 | mappedPath = http.Server.MapPath(path); 48 | return true; 49 | } 50 | catch (Exception) 51 | { 52 | mappedPath = null; 53 | return false; 54 | } 55 | 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/PathsCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace ClientDependency.Core 6 | { 7 | /// 8 | /// Allows for globally specifying paths for path aliases when registering dependencies 9 | /// 10 | public static class PathsCollection 11 | { 12 | private static readonly List Paths = new List(); 13 | private static readonly object Locker = new object(); 14 | 15 | public static void AddPath(string name, string path, bool forceBundle = false) 16 | { 17 | lock (Locker) 18 | { 19 | var bp = new BasicPath(name, path) {ForceBundle = forceBundle}; 20 | if (!Paths.Contains(bp)) 21 | { 22 | Paths.Add(bp); 23 | } 24 | } 25 | } 26 | 27 | internal static IEnumerable GetPaths() 28 | { 29 | return Paths.ToArray(); 30 | } 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/PlaceholderReplacementEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | using System.Web; 3 | 4 | namespace ClientDependency.Core 5 | { 6 | internal class PlaceholderReplacementEventArgs : PlaceholdersReplacedEventArgs 7 | { 8 | public ClientDependencyType Type { get; private set; } 9 | public Match RegexMatch { get; private set; } 10 | 11 | public PlaceholderReplacementEventArgs( 12 | HttpContextBase httpContext, 13 | ClientDependencyType type, 14 | string replacedText, 15 | Match regexMatch) 16 | : base(httpContext, replacedText) 17 | { 18 | Type = type; 19 | RegexMatch = regexMatch; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/PlaceholdersReplacedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | 4 | namespace ClientDependency.Core 5 | { 6 | internal class PlaceholdersReplacedEventArgs : EventArgs 7 | { 8 | public HttpContextBase HttpContext { get; private set; } 9 | public string ReplacedText { get; set; } 10 | 11 | public PlaceholdersReplacedEventArgs(HttpContextBase httpContext, string replacedText) 12 | { 13 | HttpContext = httpContext; 14 | ReplacedText = replacedText; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/ProviderDependencyList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ClientDependency.Core.FileRegistration.Providers; 6 | 7 | 8 | namespace ClientDependency.Core 9 | { 10 | internal class ProviderDependencyList 11 | { 12 | internal ProviderDependencyList(BaseFileRegistrationProvider provider) 13 | { 14 | Provider = provider; 15 | Dependencies = new List(); 16 | } 17 | 18 | internal bool ProviderIs(BaseFileRegistrationProvider provider) 19 | { 20 | return Provider.Name == provider.Name; 21 | } 22 | 23 | internal void AddDependencies(IEnumerable list) 24 | { 25 | Dependencies.AddRange(list); 26 | } 27 | 28 | internal void AddDependency(IClientDependencyFile file) 29 | { 30 | Dependencies.Add(file); 31 | } 32 | 33 | internal List Dependencies { get; private set; } 34 | internal BaseFileRegistrationProvider Provider { get; private set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/ClientDependency.Core/RendererOutput.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Core 2 | { 3 | internal class RendererOutput 4 | { 5 | public string Name { get; set; } 6 | public string OutputJs { get; set; } 7 | public string OutputCss { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/ClientDependency.Core/cdf.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Core/cdf.snk -------------------------------------------------------------------------------- /src/ClientDependency.Core/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/ClientDependency.Less/CdfFileReader.cs: -------------------------------------------------------------------------------- 1 | using System.Security; 2 | using System.Web; 3 | using dotless.Core.Input; 4 | 5 | namespace ClientDependency.Less 6 | { 7 | [SecurityCritical] 8 | public class CdfFileReader : dotless.Core.Input.IFileReader 9 | { 10 | public CdfFileReader() 11 | { 12 | _innerReader = new FileReader( 13 | new CdfPathResolver(new HttpContextWrapper(HttpContext.Current), (string)HttpContext.Current.Items["Cdf_LessWriter_origUrl"])); 14 | } 15 | 16 | private readonly FileReader _innerReader; 17 | 18 | [SecurityCritical] 19 | public byte[] GetBinaryFileContents(string fileName) 20 | { 21 | return _innerReader.GetBinaryFileContents(fileName); 22 | } 23 | 24 | [SecurityCritical] 25 | public string GetFileContents(string fileName) 26 | { 27 | return _innerReader.GetFileContents(fileName); 28 | } 29 | 30 | [SecurityCritical] 31 | public bool DoesFileExist(string fileName) 32 | { 33 | return _innerReader.DoesFileExist(fileName); 34 | } 35 | 36 | public bool UseCacheDependencies 37 | { 38 | [SecurityCritical] 39 | get { return false; } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/ClientDependency.Less/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Security; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ClientDependency.Less")] 10 | [assembly: AssemblyDescription("An extension for the ClientDependency framework to support .Less (dotLess)")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyProduct("ClientDependency.Less")] 13 | 14 | // Setting ComVisible to false makes the types in this assembly not visible 15 | // to COM components. If you need to access a type in this assembly from 16 | // COM, set the ComVisible attribute to true on that type. 17 | [assembly: ComVisible(false)] 18 | 19 | // The following GUID is for the ID of the typelib if this project is exposed to COM 20 | [assembly: Guid("dcbd34ab-5f2c-4fa8-8e92-2cf0d4f41b6b")] 21 | 22 | [assembly: AllowPartiallyTrustedCallers] -------------------------------------------------------------------------------- /src/ClientDependency.Less/StartupHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using ClientDependency.Core; 3 | using ClientDependency.Less; 4 | 5 | [assembly: PreApplicationStartMethod(typeof(StartupHandler), "Initialize")] 6 | 7 | namespace ClientDependency.Less 8 | { 9 | /// 10 | /// Class called to register the less writer 11 | /// 12 | public static class StartupHandler 13 | { 14 | public static void Initialize() 15 | { 16 | //register the less writer. 17 | FileWriters.AddWriterForExtension(".less", new LessWriter()); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ClientDependency.Less/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/ClientDependency.Less/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/CdfRazorView.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Web.Mvc; 4 | 5 | namespace ClientDependency.Core.Mvc 6 | { 7 | /// 8 | /// A razor view that ensures that CDF scripts/styles are rendered correctly 9 | /// 10 | public class CdfRazorView : RazorView 11 | { 12 | public CdfRazorView(ControllerContext controllerContext, string viewPath, string layoutPath, bool runViewStartPages, IEnumerable viewStartFileExtensions) 13 | : base(controllerContext, viewPath, layoutPath, runViewStartPages, viewStartFileExtensions) 14 | { 15 | } 16 | 17 | public CdfRazorView(ControllerContext controllerContext, string viewPath, string layoutPath, bool runViewStartPages, IEnumerable viewStartFileExtensions, IViewPageActivator viewPageActivator) 18 | : base(controllerContext, viewPath, layoutPath, runViewStartPages, viewStartFileExtensions, viewPageActivator) 19 | { 20 | } 21 | 22 | protected override void RenderView(ViewContext viewContext, TextWriter writer, object instance) 23 | { 24 | using (var replacements = new PlaceholderReplacer(writer, viewContext.HttpContext)) 25 | { 26 | base.RenderView(viewContext, replacements.Writer, instance); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/CdfRazorViewEngine.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace ClientDependency.Core.Mvc 4 | { 5 | public class CdfRazorViewEngine : RazorViewEngine 6 | { 7 | protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath) 8 | { 9 | return new CdfRazorView(controllerContext, partialPath, null, false, FileExtensions, ViewPageActivator); 10 | } 11 | 12 | protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath) 13 | { 14 | return new CdfRazorView(controllerContext, viewPath, masterPath, true, FileExtensions, ViewPageActivator); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/DependencyRendererExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace ClientDependency.Core.Mvc 5 | { 6 | /// 7 | /// Extension methods for ClientDependency 8 | /// 9 | public static class DependencyRendererExtensions 10 | { 11 | 12 | /// 13 | /// Gets the loader from the ViewContext 14 | /// 15 | /// 16 | /// 17 | public static DependencyRenderer GetLoader(this ViewContext vc) 18 | { 19 | bool isNew; 20 | var instance = DependencyRenderer.TryCreate(vc.HttpContext, out isNew); 21 | return instance; 22 | } 23 | 24 | /// 25 | /// Gets the loader from the ControllerContext 26 | /// 27 | /// 28 | /// 29 | public static DependencyRenderer GetLoader(this ControllerContext cc) 30 | { 31 | bool isNew; 32 | var instance = DependencyRenderer.TryCreate(cc.HttpContext, out isNew); 33 | return instance; 34 | } 35 | 36 | /// 37 | /// Gets the loader from the HttpContextBase 38 | /// 39 | /// 40 | /// 41 | public static DependencyRenderer GetLoader(this HttpContextBase http) 42 | { 43 | bool isNew; 44 | var instance = DependencyRenderer.TryCreate(http, out isNew); 45 | return instance; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/MvcRogueFileFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ClientDependency.Core.Module; 6 | using ClientDependency.Core.Config; 7 | using System.Web; 8 | using System.Web.Mvc; 9 | 10 | namespace ClientDependency.Core.Mvc 11 | { 12 | /// 13 | /// Rogue file filter for ASP.Net MVC 14 | /// 15 | internal class MvcRogueFileFilter : RogueFileFilter 16 | { 17 | 18 | /// 19 | /// Overridden to check for MVC Handler 20 | /// 21 | /// 22 | public override bool ValidateCurrentHandler() 23 | { 24 | //don't filter if we're in debug mode 25 | if (CurrentContext.IsDebuggingEnabled) 26 | return false; 27 | 28 | IHttpHandler handler = CurrentContext.CurrentHandler as MvcHandler; 29 | if (handler != null) 30 | { 31 | return true; 32 | } 33 | return false; 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Security; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ClientDependency.Mvc")] 10 | [assembly: AssemblyDescription("An extension for the ClientDependency framework to support ASP.Net MVC")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyProduct("ClientDependency.Mvc")] 13 | 14 | // Setting ComVisible to false makes the types in this assembly not visible 15 | // to COM components. If you need to access a type in this assembly from 16 | // COM, set the ComVisible attribute to true on that type. 17 | [assembly: ComVisible(false)] 18 | 19 | // The following GUID is for the ID of the typelib if this project is exposed to COM 20 | [assembly: Guid("edff80c4-ff38-4468-9f25-088e4c54ebbb")] 21 | 22 | #if Debug || Release 23 | [assembly: AllowPartiallyTrustedCallers] 24 | #endif -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/ViewEnginesExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Web.Mvc; 3 | 4 | namespace ClientDependency.Core.Mvc 5 | { 6 | public static class ViewEnginesExtensions 7 | { 8 | /// 9 | /// Replaces the default razor view engine with the specified one 10 | /// 11 | /// 12 | /// 13 | public static void ReplaceDefaultRazorEngine(this ViewEngineCollection engines, IViewEngine replacement) 14 | { 15 | engines.ReplaceEngine(replacement); 16 | } 17 | 18 | /// 19 | /// Replaces the engine matching 'T' with the specified one 20 | /// 21 | /// 22 | /// 23 | /// 24 | public static void ReplaceEngine(this ViewEngineCollection engines, IViewEngine replacement) 25 | where T : IViewEngine 26 | { 27 | var engine = engines.SingleOrDefault(x => x.GetType() == typeof(T)); 28 | if (engine != null) 29 | { 30 | engines.Remove(engine); 31 | } 32 | engines.Add(replacement); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/cdf.pub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Mvc/cdf.pub -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/cdf.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Mvc/cdf.snk -------------------------------------------------------------------------------- /src/ClientDependency.Mvc/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ClientDependency.SASS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClientDependency.SASS")] 9 | [assembly: AssemblyDescription("An extension for the ClientDependency framework to support SASS")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyProduct("ClientDependency.SASS")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("f4187611-9507-40b1-9ff2-2dbfa965be2a")] 20 | -------------------------------------------------------------------------------- /src/ClientDependency.SASS/SassHandler.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Web; 3 | using ClientDependency.Core; 4 | 5 | namespace ClientDependency.SASS 6 | { 7 | /// 8 | /// An http handler for .coffee extensions which is used when in debug mode 9 | /// 10 | public class SassHandler : IHttpHandler 11 | { 12 | public void ProcessRequest(HttpContext context) 13 | { 14 | var localPath = context.Request.Url.LocalPath; 15 | if (string.IsNullOrEmpty(localPath)) return; 16 | var file = new FileInfo(context.Server.MapPath(localPath)); 17 | var writer = new SassWriter(); 18 | var output = writer.GetOutput(file); 19 | context.Response.ContentType = "text/css"; 20 | context.Response.Write(output); 21 | } 22 | 23 | public bool IsReusable 24 | { 25 | get { return false; } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/ClientDependency.SASS/StartupHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using ClientDependency.Core; 3 | using ClientDependency.SASS; 4 | 5 | [assembly: PreApplicationStartMethod(typeof(StartupHandler), "Initialize")] 6 | 7 | namespace ClientDependency.SASS 8 | { 9 | /// 10 | /// Class called to register the less writer 11 | /// 12 | public static class StartupHandler 13 | { 14 | public static void Initialize() 15 | { 16 | //register the less writer. 17 | FileWriters.AddWriterForExtension(".sass", new SassWriter()); 18 | FileWriters.AddWriterForExtension(".scss", new SassWriter()); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ClientDependency.SASS/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/ClientDependency.TypeScript/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClientDependency.TypeScript")] 9 | [assembly: AssemblyDescription("An extension for the ClientDependency framework to support TypeScript")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyProduct("ClientDependency.TypeScript")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("022852ef-c075-41fb-814e-56a579bf060e")] 20 | 21 | [assembly: InternalsVisibleTo("ClientDependency.UnitTests")] -------------------------------------------------------------------------------- /src/ClientDependency.TypeScript/StartupHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using ClientDependency.Core; 3 | using ClientDependency.TypeScript; 4 | 5 | [assembly: PreApplicationStartMethod(typeof(StartupHandler), "Initialize")] 6 | 7 | namespace ClientDependency.TypeScript 8 | { 9 | /// 10 | /// Class called to register the less writer 11 | /// 12 | public static class StartupHandler 13 | { 14 | public static void Initialize() 15 | { 16 | //register the less writer. 17 | FileWriters.AddWriterForExtension(".ts", new TypeScriptWriter()); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ClientDependency.TypeScript/TypeScriptCompilationError.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.TypeScript 2 | { 3 | /// 4 | /// Defines one compilation type script error 5 | /// 6 | public sealed class TypeScriptCompilationError 7 | { 8 | public TypeScriptCompilationError(string message, string codeBlock, int startPosition, int length) 9 | { 10 | Message = message; 11 | CodeBlock = codeBlock; 12 | StartPosition = startPosition; 13 | Length = length; 14 | } 15 | 16 | public string Message { get; private set; } 17 | public string CodeBlock { get; private set; } 18 | public int StartPosition { get; private set; } 19 | public int Length { get; private set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/ClientDependency.TypeScript/TypeScriptCompilationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Text; 4 | 5 | namespace ClientDependency.TypeScript 6 | { 7 | /// 8 | /// An exception object that is thrown when there is a TypeScript compilation error 9 | /// 10 | public sealed class TypeScriptCompilationException : Exception 11 | { 12 | public TypeScriptCompilationError[] Errors { get; private set; } 13 | 14 | internal TypeScriptCompilationException(params TypeScriptCompilationError[] errors) 15 | { 16 | Errors = errors; 17 | } 18 | 19 | public override string Message 20 | { 21 | get { return string.Format("There were {0} TypeScript compilation errors", Errors.Length); } 22 | } 23 | 24 | public override string StackTrace 25 | { 26 | get 27 | { 28 | var builder = new StringBuilder(); 29 | foreach (var e in Errors) 30 | { 31 | builder.Append(e.Message); 32 | builder.Append(", Code Block: "); 33 | builder.Append(e.CodeBlock); 34 | builder.Append(", Start Position: "); 35 | builder.Append(e.StartPosition); 36 | builder.Append(", Length: "); 37 | builder.AppendLine(e.Length.ToString(CultureInfo.InvariantCulture)); 38 | } 39 | return builder.ToString(); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/ClientDependency.TypeScript/TypeScriptHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using ClientDependency.Core; 3 | 4 | namespace ClientDependency.TypeScript 5 | { 6 | /// 7 | /// An http handler for .coffee extensions which is used when in debug mode 8 | /// 9 | public class TypeScriptHandler : IHttpHandler 10 | { 11 | public void ProcessRequest(HttpContext context) 12 | { 13 | var localPath = context.Request.Url.LocalPath; 14 | if (string.IsNullOrEmpty(localPath)) return; 15 | var reader = new VirtualPathFileReader(); 16 | var fileContents = reader.ReadFile(localPath); 17 | var writer = new TypeScriptWriter(); 18 | var engine = writer.GetEngine(); 19 | var output = writer.CompileTypeScript(engine, fileContents); 20 | context.Response.ContentType = "text/javascript"; 21 | context.Response.Write(output); 22 | } 23 | 24 | public bool IsReusable 25 | { 26 | get { return false; } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ClientDependency.TypeScript/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/ClientDependency.UnitTests/MinSections.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/ClientDependency.UnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClientDependency.UnitTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("ClientDependency.UnitTests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d0a1c198-abe2-40ac-a5c1-fdf2c38ab8ea")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /src/ClientDependency.UnitTests/RogueFileFilterTest.cs: -------------------------------------------------------------------------------- 1 | using ClientDependency.Core.Module; 2 | using NUnit.Framework; 3 | using System; 4 | 5 | namespace ClientDependency.UnitTests 6 | { 7 | 8 | 9 | /// 10 | ///This is a test class for RogueFileFilterTest and is intended 11 | ///to contain all RogueFileFilterTest Unit Tests 12 | /// 13 | [TestFixture] 14 | public class RogueFileFilterTest 15 | { 16 | 17 | /// 18 | ///A test for CanExecute 19 | /// 20 | [Test] 21 | public void RogueFiles_Can_Execute() 22 | { 23 | 24 | Assert.Inconclusive("Verify the correctness of this test method."); 25 | } 26 | 27 | /// 28 | ///A test for UpdateOutputHtml 29 | /// 30 | [Test] 31 | public void RogueFiles_Update_Output_Html() 32 | { 33 | 34 | Assert.Inconclusive("Verify the correctness of this test method."); 35 | } 36 | 37 | /// 38 | ///A test for ValidateCurrentHandler 39 | /// 40 | [Test] 41 | public void RogueFiles_Validate_Current_Handler() 42 | { 43 | 44 | Assert.Inconclusive("Verify the correctness of this test method."); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/ClientDependency.UnitTests/StringExtensionsTest.cs: -------------------------------------------------------------------------------- 1 | using ClientDependency.Core; 2 | using NUnit.Framework; 3 | 4 | namespace ClientDependency.UnitTests 5 | { 6 | 7 | [TestFixture] 8 | public class StringExtensionsTest 9 | { 10 | [Test] 11 | public void Non_Alphanumeric() 12 | { 13 | var name = "Hello@#b[sdfsd/sde=+1!"; 14 | var safe = name.ReplaceNonAlphanumericChars('-'); 15 | foreach (var c in safe) 16 | { 17 | Assert.IsTrue(char.IsLetterOrDigit(c) || c == '-'); 18 | } 19 | } 20 | 21 | [Test] 22 | public void Decode_From_64_Url() 23 | { 24 | var files = "/VirtualFolderTest/Pages/relative.css;/VirtualFolderTest/Css/Site.css;/VirtualFolderTest/Css/ColorScheme.css;/VirtualFolderTest/Css/Controls.css;/VirtualFolderTest/Css/CustomControl.css;/VirtualFolderTest/Css/Content.css;"; 25 | var encodedFiles = files.EncodeTo64Url(); 26 | 27 | var decoded = encodedFiles.DecodeFrom64Url(); 28 | 29 | Assert.AreEqual(files, decoded); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/ClientDependency.UnitTests/cdf.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.UnitTests/cdf.snk -------------------------------------------------------------------------------- /src/ClientDependency.UnitTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MvcApplication1.Controllers 8 | { 9 | [HandleError] 10 | public class HomeController : Controller 11 | { 12 | public ActionResult Index() 13 | { 14 | ViewData["Message"] = "Welcome to ASP.NET MVC!"; 15 | 16 | return View(); 17 | } 18 | 19 | public ActionResult About() 20 | { 21 | return View(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controllers/TestController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | using ClientDependency.Core.Mvc; 4 | using ClientDependency.Web.Test.Models; 5 | 6 | namespace ClientDependency.Web.Test.Controllers 7 | { 8 | 9 | 10 | public class TestController : Controller 11 | { 12 | /// 13 | /// Try to render any view that matches the action name 14 | /// 15 | /// 16 | protected override void HandleUnknownAction(string actionName) 17 | { 18 | try 19 | { 20 | this.View(actionName).ExecuteResult(this.ControllerContext); 21 | } 22 | catch (InvalidOperationException ieox) 23 | { 24 | throw; 25 | //ViewData["error"] = "Unknown Action: \"" + 26 | // Server.HtmlEncode(actionName) + "\""; 27 | //ViewData["exMessage"] = ieox.Message; 28 | //this.View("Error").ExecuteResult(this.ControllerContext); 29 | } 30 | } 31 | 32 | /// 33 | /// Custom action to dynamically register a dependency in an action 34 | /// 35 | /// 36 | public ActionResult DynamicPathRegistration() 37 | { 38 | ControllerContext.GetLoader().AddPath("NewJsPath", "~/Js/TestPath"); 39 | 40 | return View(new TestModel()); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/Footer.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Footer.ascx.cs" Inherits="ClientDependency.Web.Test.Controls.Footer" %> 2 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 3 | 4 | 5 | 6 | 7 | <%--Demonstrates the use of using the PathNameAlias--%> 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/Footer.ascx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Controls 9 | { 10 | public partial class Footer : System.Web.UI.UserControl 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/Header.ascx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Controls 9 | { 10 | 11 | public partial class Header : System.Web.UI.UserControl 12 | { 13 | protected void Page_Load(object sender, EventArgs e) 14 | { 15 | 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/Header.ascx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ClientDependency.Web.Test.Controls { 11 | 12 | 13 | public partial class Header { 14 | 15 | /// 16 | /// CssInclude1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/MyCustomControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.HtmlControls; 7 | using ClientDependency.Core; 8 | 9 | namespace ClientDependency.Web.Test.Controls 10 | { 11 | 12 | /// 13 | /// This simply demonstrates using attributes to register file dependencies. 14 | /// 15 | [ClientDependency(ClientDependencyType.Css, "~/Css/CustomControl.css")] 16 | public class MyCustomControl : Control 17 | { 18 | 19 | private HtmlGenericControl m_MainDiv; 20 | 21 | 22 | protected override void CreateChildControls() 23 | { 24 | base.CreateChildControls(); 25 | 26 | m_MainDiv = new HtmlGenericControl(); 27 | //m_MainDiv.ID = "myControl"; 28 | m_MainDiv.Attributes.Add("class", "myControl"); 29 | m_MainDiv.Controls.Add(new LiteralControl("
My Custom Control
")); 30 | 31 | this.Controls.Add(m_MainDiv); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/Sidebar.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Sidebar.ascx.cs" Inherits="ClientDependency.Web.Test.Controls.Sidebar" %> 2 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 3 | <%@ Register Namespace="ClientDependency.Web.Test.Controls" Assembly="ClientDependency.Web.Test" TagPrefix="Web" %> 4 | 5 | 6 | 7 | 8 | <%--Demonstrates the use of using the PathNameAlias--%> 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/Sidebar.ascx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Controls 9 | { 10 | public partial class Sidebar : System.Web.UI.UserControl 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Controls/Sidebar.ascx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ClientDependency.Web.Test.Controls { 11 | 12 | 13 | public partial class Sidebar { 14 | 15 | /// 16 | /// JsInclude1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; 23 | 24 | /// 25 | /// CssInclude2 control. 26 | /// 27 | /// 28 | /// Auto-generated field. 29 | /// To modify move field declaration from designer file to code-behind file. 30 | /// 31 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude2; 32 | 33 | /// 34 | /// MyControl control. 35 | /// 36 | /// 37 | /// Auto-generated field. 38 | /// To modify move field declaration from designer file to code-behind file. 39 | /// 40 | protected global::ClientDependency.Web.Test.Controls.MyCustomControl MyControl; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/BundleTest/css1.css: -------------------------------------------------------------------------------- 1 | body { 2 | border-style: solid; 3 | } 4 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/BundleTest/css2.css: -------------------------------------------------------------------------------- 1 | body { 2 | border-width: 3px; 3 | } 4 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/BundleTest/css3.css: -------------------------------------------------------------------------------- 1 | body { 2 | border-color: green; 3 | } 4 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/ColorScheme.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | background-color:#D1EEF9; 4 | color:#000; 5 | } 6 | a 7 | { 8 | color: #000; 9 | } 10 | 11 | .white {color:White;} 12 | .black {color:Black;} 13 | 14 | .bg-primary-1 { background-color: #D1EEF9; } 15 | .bg-primary-2 { background-color: #777E81; } 16 | .bg-primary-3 { background-color: #033C52; } 17 | .bg-primary-4 { background-color: #D7F1FA; } 18 | .bg-primary-5 { background-color: #DBF2FA; } 19 | 20 | .bg-complement-1 { background-color: #FFEBD5; } 21 | .bg-complement-2 { background-color: #857F79; } 22 | .bg-complement-3 { background-color: #542D03; } 23 | .bg-complement-4 { background-color: #FFEDDA; } 24 | .bg-complement-5 { background-color: #FFEFDE; } 25 | 26 | .f-primary-1 { color: #D1EEF9; } 27 | .f-primary-2 { color: #777E81; } 28 | .f-primary-3 { color: #033C52; } 29 | .f-primary-4 { color: #D7F1FA; } 30 | .f-primary-5 { color: #DBF2FA; } 31 | 32 | .f-complement-1 { color: #FFEBD5; } 33 | .f-complement-2 { color: #857F79; } 34 | .f-complement-3 { color: #542D03; } 35 | .f-complement-4 { color: #FFEDDA; } 36 | .f-complement-5 { color: #FFEFDE; } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Content.css: -------------------------------------------------------------------------------- 1 | @import url('//fonts.googleapis.com/css?subset=latin,cyrillic-ext,latin-ext,cyrillic&family=Open+Sans+Condensed:300|Open+Sans:400,600,400italic,600italic|Merriweather:400,300,300italic,400italic,700,700italic|Roboto+Slab:400,300'); 2 | @import url('//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'); 3 | @import url("http://fonts.googleapis.com/css?family=Roboto:400,700"); 4 | 5 | .mainContent 6 | { 7 | border:solid 1px #542D03; 8 | float:left; 9 | clear:right; 10 | padding:5px; 11 | margin:3px; 12 | width:700px; 13 | } 14 | 15 | .control.header ul li 16 | { 17 | 18 | float:left; 19 | width:450px; 20 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Controls.css: -------------------------------------------------------------------------------- 1 | .control 2 | { 3 | border:solid 1px #857F79; 4 | display:block; 5 | padding:5px; 6 | margin:3px; 7 | } 8 | 9 | .control.header 10 | { 11 | display:block; 12 | height:190px; 13 | width:968px; 14 | background: transparent url(../Images/header.gif) repeat top left; 15 | } 16 | 17 | .control.footer 18 | { 19 | display:block; 20 | height:50px; 21 | width:968px; 22 | } 23 | 24 | .control.sidebar 25 | { 26 | float:left; 27 | width:250px; 28 | height:100%; 29 | display:block; 30 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/CustomControl.css: -------------------------------------------------------------------------------- 1 | .myControl 2 | { 3 | margin:10px; 4 | display:block; 5 | width:230px; 6 | height:100px; 7 | border:dashed 1px white; 8 | } 9 | .myControl div 10 | { 11 | padding:40px; 12 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Default.css: -------------------------------------------------------------------------------- 1 | div 2 | { 3 | font-size:100pt; 4 | text-align:center; 5 | font-size:100pt; 6 | } 7 | 8 | a 9 | { 10 | font-size:100pt; 11 | text-decoration:none; 12 | display:block; 13 | } 14 | 15 | div.link 16 | { 17 | margin:auto; 18 | margin-bottom:10px; 19 | border: dashed 1px #542D03; 20 | width:700px; 21 | } 22 | a:hover 23 | { 24 | display:block; 25 | background-color:#033C52; 26 | color:#FFEBD5; 27 | text-decoration:none; 28 | cursor:pointer; 29 | } 30 | .choose 31 | { 32 | font-size:22pt; 33 | margin:20px; 34 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Imports.css: -------------------------------------------------------------------------------- 1 | @import url(Content.css); 2 | @import url("../Css/OverrideStyles.css"); 3 | @import url('/VirtualFolderTest/Css/Print.css'); 4 | @import url('//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'); 5 | 6 | html * { 7 | border-style: dotted !important; 8 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/_testvars.scss: -------------------------------------------------------------------------------- 1 | $use-grids: false; 2 | $use-flexbox: false; 3 | $use-columns: false; 4 | $use-nav: false; 5 | $use-options: false; 6 | $use-pagination: false; 7 | $use-breadcrumb: false; 8 | $use-media: false; 9 | $use-marginalia: false; 10 | $use-island: false; 11 | $use-block-list: false; 12 | $use-matrix: false; 13 | $use-split: false; 14 | $use-this-or-this: false; 15 | $use-link-complex: false; 16 | $use-flyout: false; 17 | $use-arrows: false; 18 | $use-sprite: false; 19 | $use-icon-text: false; 20 | $use-beautons: false; 21 | $use-lozenges: false; 22 | $use-rules: false; 23 | $use-stats: false; 24 | $use-greybox: false; -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/_defaults.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Web.Test/Css/Inuit/inuit.css/_defaults.scss -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/_inuit.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Web.Test/Css/Inuit/inuit.css/_inuit.scss -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/base/_headings.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $HEADINGS 3 | \*------------------------------------*/ 4 | /** 5 | * As per: csswizardry.com/2012/02/pragmatic-practical-font-sizing-in-css 6 | * 7 | * When we define a heading we also define a corresponding class to go with it. 8 | * This allows us to apply, say, `class=alpha` to a `h3`; a double-stranded 9 | * heading hierarchy. 10 | */ 11 | h1,.alpha{ 12 | @include font-size($h1-size); 13 | } 14 | h2,.beta{ 15 | @include font-size($h2-size); 16 | } 17 | h3,.gamma{ 18 | @include font-size($h3-size); 19 | } 20 | h4,.delta{ 21 | @include font-size($h4-size); 22 | } 23 | h5,.epsilon{ 24 | @include font-size($h5-size); 25 | } 26 | h6,.zeta{ 27 | @include font-size($h6-size); 28 | } 29 | 30 | 31 | /** 32 | * Heading groups and generic any-heading class. 33 | * To target any heading of any level simply apply a class of `.hN`, e.g.: 34 | * 35 |
36 |

inuit.css

37 |

Best. Framework. Ever!

38 |
39 | * 40 | */ 41 | .hN{ 42 | } 43 | hgroup .hN{ 44 | margin-bottom:0; 45 | } 46 | 47 | 48 | /** 49 | * A series of classes for setting massive type; for use in heroes, mastheads, 50 | * promos, etc. 51 | */ 52 | .giga{ 53 | @include font-size($giga-size); 54 | } 55 | .mega{ 56 | @include font-size($mega-size); 57 | } 58 | .kilo{ 59 | @include font-size($kilo-size); 60 | } 61 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/base/_images.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $IMAGES 3 | \*------------------------------------*/ 4 | /** 5 | * Demo: jsfiddle.net/inuitcss/yMtur 6 | */ 7 | /** 8 | * Fluid images. 9 | */ 10 | img{ 11 | max-width:100%; 12 | } 13 | 14 | 15 | /** 16 | * Non-fluid images if you specify `width` and/or `height` attributes. 17 | */ 18 | img[width], 19 | img[height]{ 20 | max-width:none; 21 | } 22 | 23 | 24 | /** 25 | * Rounded images. 26 | */ 27 | .img--round { border-radius:$brand-round; } 28 | 29 | 30 | /** 31 | * Image placement variations. 32 | */ 33 | .img--right{ 34 | float:right; 35 | margin-bottom:$base-spacing-unit; 36 | margin-left:$base-spacing-unit; 37 | } 38 | .img--left{ 39 | float:left; 40 | margin-right:$base-spacing-unit; 41 | margin-bottom:$base-spacing-unit; 42 | } 43 | .img--center{ 44 | display:block; 45 | margin-right:auto; 46 | margin-bottom:$base-spacing-unit; 47 | margin-left:auto; 48 | } 49 | 50 | 51 | /** 52 | * Keep your images on your baseline. 53 | * 54 | * Please note, these will not work too nicely with fluid images and will 55 | * distort when resized below a certain width. Use with caution. 56 | */ 57 | .img--short{ 58 | height:5 * $base-spacing-unit; 59 | } 60 | .img--medium{ 61 | height:10 * $base-spacing-unit; 62 | } 63 | .img--tall{ 64 | height:15 * $base-spacing-unit; 65 | } 66 | 67 | 68 | /** 69 | * Images in `figure` elements. 70 | */ 71 | figure > img{ 72 | display:block; 73 | } 74 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/base/_lists.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $LISTS 3 | \*------------------------------------*/ 4 | /** 5 | * Remove vertical spacing from nested lists. 6 | */ 7 | li{ 8 | > ul, 9 | > ol{ 10 | margin-bottom:0; 11 | } 12 | } 13 | 14 | /** 15 | * Have a numbered `ul` without the semantics implied by using an `ol`. 16 | */ 17 | /*ul*/.numbered-list{ 18 | list-style-type:decimal; 19 | } 20 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/base/_main.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $MAIN 3 | \*------------------------------------*/ 4 | html{ 5 | font:#{($base-font-size/16px)*1em}/#{$line-height-ratio} $base-font-family; 6 | overflow-y:scroll; 7 | min-height:100%; 8 | } 9 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/base/_paragraphs.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $PARAGRAPHS 3 | \*------------------------------------*/ 4 | /** 5 | * The `.lede` class is used to make the introductory text (usually a paragraph) 6 | * of a document slightly larger. 7 | */ 8 | .lede, 9 | .lead{ 10 | @include font-size($base-font-size * 1.125); 11 | } 12 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/base/_smallprint.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $SMALLPRINT 3 | \*------------------------------------*/ 4 | /** 5 | * A series of classes for setting tiny type; for use in smallprint etc. 6 | */ 7 | .smallprint, 8 | .milli{ 9 | @include font-size($milli-size); 10 | } 11 | .micro{ 12 | @include font-size($micro-size); 13 | } 14 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/generic/_brand.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $BRAND 3 | \*------------------------------------*/ 4 | /** 5 | * `.brand` is a quick and simple way to apply your brand face and/or color to 6 | * any element using a handy helper class. 7 | */ 8 | .brand{ 9 | font-family:$brand-face +!important; 10 | color:$brand-color +!important; 11 | } 12 | .brand-face{ 13 | font-family:$brand-face +!important; 14 | } 15 | .brand-color, 16 | .brand-colour{ 17 | color:$brand-color +!important; 18 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/generic/_clearfix.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $CLEARFIX 3 | \*------------------------------------*/ 4 | /** 5 | * Micro clearfix, as per: css-101.org/articles/clearfix/latest-new-clearfix-so-far.php 6 | * Extend the clearfix class with Sass to avoid the `.cf` class appearing over 7 | * and over in your markup. 8 | */ 9 | .cf{ 10 | &:after{ 11 | content:""; 12 | display:table; 13 | clear:both; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/generic/_reset.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | $RESET 3 | \*------------------------------------*/ 4 | /** 5 | * A more considered reset; more of a restart... 6 | * As per: csswizardry.com/2011/10/reset-restarted 7 | */ 8 | 9 | @if $global-border-box == true{ 10 | /** 11 | * Let’s make the box model all nice, shall we...? 12 | */ 13 | *{ 14 | &, 15 | &:before, 16 | &:after{ 17 | @include vendor(box-sizing, border-box); 18 | } 19 | } 20 | } 21 | 22 | /** 23 | * The usual... 24 | */ 25 | h1,h2,h3,h4,h5,h6, 26 | p,blockquote,pre, 27 | dl,dd,ol,ul, 28 | form,fieldset,legend, 29 | table,th,td,caption, 30 | hr{ 31 | margin:0; 32 | padding:0; 33 | } 34 | 35 | /** 36 | * Give a help cursor to elements that give extra info on `:hover`. 37 | */ 38 | abbr[title],dfn[title]{ 39 | cursor:help; 40 | } 41 | 42 | /** 43 | * Remove underlines from potentially troublesome elements. 44 | */ 45 | u,ins{ 46 | text-decoration:none; 47 | } 48 | 49 | /** 50 | * Apply faux underline via `border-bottom`. 51 | */ 52 | ins{ 53 | border-bottom:1px solid; 54 | } 55 | 56 | /** 57 | * So that `alt` text is visually offset if images don’t load. 58 | */ 59 | img{ 60 | font-style:italic; 61 | } 62 | 63 | /** 64 | * Give form elements some cursor interactions... 65 | */ 66 | label, 67 | input, 68 | textarea, 69 | button, 70 | select, 71 | option{ 72 | cursor:pointer; 73 | } 74 | .text-input:active, 75 | .text-input:focus, 76 | textarea:active, 77 | textarea:focus{ 78 | cursor:text; 79 | outline:none; 80 | } 81 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_block-list.scss: -------------------------------------------------------------------------------- 1 | @if $use-block-list == true or $use-matrix == true{ 2 | 3 | /*------------------------------------*\ 4 | $BLOCK-LIST 5 | \*------------------------------------*/ 6 | /** 7 | * Create big blocky lists of content, e.g.: 8 | * 9 | 15 | * 16 | * Extend this object in your theme stylesheet. 17 | * 18 | * Demo: jsfiddle.net/inuitcss/hR57q 19 | * 20 | */ 21 | .block-list{ 22 | 23 | &, 24 | > li{ 25 | border:0 solid $base-ui-color; 26 | } 27 | } 28 | .block-list{ 29 | list-style:none; 30 | margin-left:0; 31 | border-top-width:1px; 32 | 33 | > li{ 34 | border-bottom-width:1px; 35 | padding:$half-spacing-unit; 36 | } 37 | } 38 | .block-list__link{ 39 | display:block; 40 | padding:$half-spacing-unit; 41 | margin:-$half-spacing-unit; 42 | } 43 | 44 | }//endif 45 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_columns.scss: -------------------------------------------------------------------------------- 1 | @if $use-columns == true{ 2 | 3 | /*------------------------------------*\ 4 | $COLUMNS 5 | \*------------------------------------*/ 6 | /** 7 | * Here we can set elements in columns of text using CSS3, e.g.: 8 | * 9 |

10 | * 11 | * Demo: jsfiddle.net/inuitcss/E26Yd 12 | * 13 | */ 14 | %text-cols{ 15 | @include vendor(column-gap, $base-spacing-unit); 16 | } 17 | .text-cols--2 { @extend %text-cols; @include vendor(column-count, 2); } 18 | .text-cols--3 { @extend %text-cols; @include vendor(column-count, 3); } 19 | .text-cols--4 { @extend %text-cols; @include vendor(column-count, 4); } 20 | .text-cols--5 { @extend %text-cols; @include vendor(column-count, 5); } 21 | 22 | }//endif 23 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_flexbox.scss: -------------------------------------------------------------------------------- 1 | @if $use-flexbox == true{ 2 | 3 | /*------------------------------------*\ 4 | $FLEXBOX 5 | \*------------------------------------*/ 6 | /** 7 | * Until we can utilise flexbox natively we can kinda, sorta, attempt to emulate 8 | * it, in a way... e.g.: 9 | * 10 |

11 | 12 |
13 | Welcome to 14 |
15 | 16 |
17 | inuit.css 18 |
19 | 20 |
21 | * 22 | * We can also combine our grid system classes with `.flexbox__item` classes, 23 | * e.g.: 24 | * 25 |
26 |
27 |
28 |
29 |
30 |
31 | * 32 | * It’s pretty poorly named I’m afraid, but it works... 33 | * 34 | * Demo: jsfiddle.net/inuitcss/ufUh2 35 | * 36 | */ 37 | .flexbox{ 38 | display:table; 39 | width:100%; 40 | } 41 | 42 | /** 43 | * Nasty hack to circumvent Modernizr conflicts. 44 | */ 45 | html.flexbox{ 46 | display:block; 47 | width:auto; 48 | } 49 | 50 | .flexbox__item{ 51 | display:table-cell; 52 | vertical-align:middle; 53 | } 54 | 55 | }//endif 56 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_grids.scss: -------------------------------------------------------------------------------- 1 | @if $use-grids == true{ 2 | 3 | /*------------------------------------*\ 4 | $GRIDS 5 | \*------------------------------------*/ 6 | /** 7 | * Fluid and nestable grid system, e.g.: 8 | * 9 |
10 | 11 |
16 |

Two thirds grid

17 |
20 |

One half grid

21 |
24 |

One quarter grid

25 |
28 |

One quarter grid

29 |
30 | 31 |
32 | * 33 | * Demo: jsfiddle.net/inuitcss/CLYUC 34 | * 35 | */ 36 | 37 | 38 | /** 39 | * Grid wrapper 40 | */ 41 | .grid{ 42 | margin-left:-$base-spacing-unit; 43 | list-style:none; 44 | margin-bottom:0; 45 | } 46 | 47 | 48 | /** 49 | * Very infrequently occuring grid wrappers as children of grid wrappers. 50 | */ 51 | .grid > .grid{ 52 | margin-left:0; 53 | } 54 | 55 | 56 | /** 57 | * Grid 58 | */ 59 | .grid__item{ 60 | display:inline-block; 61 | width:100%; 62 | padding-left:$base-spacing-unit; 63 | vertical-align:top; 64 | @if $global-border-box == false{ 65 | @include vendor(box-sizing, border-box); 66 | } 67 | } 68 | 69 | }//endif 70 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_icon-text.scss: -------------------------------------------------------------------------------- 1 | @if $use-icon-text == true{ 2 | 3 | /*------------------------------------*\ 4 | $ICON-TEXT 5 | \*------------------------------------*/ 6 | /** 7 | * For text-links etc that have an icon with them. Sometimes whitespace would 8 | * suffice in creating a gap between the icon and text, for example: 9 | * 10 | 11 | Help & support 12 | 13 | * 14 | * However we will sometimes want a larger, explicity set gap: 15 | 16 | Help & support 17 | 18 | * 19 | * Demo: jsfiddle.net/inuitcss/Q6Lbf 20 | * 21 | */ 22 | .icon-text > .icon-text__icon{ 23 | margin-right:$half-spacing-unit / 2; 24 | } 25 | 26 | 27 | /** 28 | * We can also reverse the direction of the margin for icons that appear to the 29 | * right of the text content, thus: 30 | * 31 | 32 | Help & support 33 | 34 | * 35 | */ 36 | .icon-text--rev > .icon-text__icon{ 37 | margin-left:$half-spacing-unit / 2; 38 | } 39 | 40 | }//endif 41 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_island.scss: -------------------------------------------------------------------------------- 1 | @if $use-island == true{ 2 | 3 | /*------------------------------------*\ 4 | $ISLAND 5 | \*------------------------------------*/ 6 | /** 7 | * Simple, boxed off content, as per: csswizardry.com/2011/10/the-island-object 8 | * E.g.: 9 | * 10 |
11 | I am boxed off. 12 |
13 | * 14 | * Demo: jsfiddle.net/inuitcss/u8pV3 15 | * 16 | */ 17 | .island, 18 | .islet{ 19 | display:block; 20 | @extend .cf; 21 | } 22 | .island{ 23 | padding:$base-spacing-unit; 24 | } 25 | .island > :last-child, 26 | .islet > :last-child{ 27 | margin-bottom:0; 28 | } 29 | 30 | 31 | /** 32 | * Just like `.island`, only smaller. 33 | */ 34 | .islet{ 35 | padding:$half-spacing-unit; 36 | } 37 | 38 | }//endif 39 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_link-complex.scss: -------------------------------------------------------------------------------- 1 | @if $use-link-complex == true{ 2 | 3 | /*------------------------------------*\ 4 | $LINK-COMPLEX 5 | \*------------------------------------*/ 6 | /** 7 | * As inspired by @necolas: 8 | * github.com/necolas/suit-utils/blob/master/link.css#L18 9 | * 10 | * Add hover behaviour to only selected items within links, e.g.: 11 | * 12 | 13 | 14 | Log in 15 | 16 | * 17 | * Demo: jsfiddle.net/inuitcss/rt9M3 18 | * 19 | */ 20 | .link-complex, 21 | .link-complex:hover, 22 | .link-complex:active, 23 | .link-complex:focus{ 24 | text-decoration:none; 25 | } 26 | .link-complex:hover .link-complex__target, 27 | .link-complex:active .link-complex__target, 28 | .link-complex:focus .link-complex__target{ 29 | text-decoration:underline; 30 | } 31 | 32 | }//endif 33 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_lozenges.scss: -------------------------------------------------------------------------------- 1 | @if $use-lozenges == true{ 2 | 3 | /*------------------------------------*\ 4 | $LOZENGES 5 | \*------------------------------------*/ 6 | /** 7 | * Create pill- and lozenge-like runs of text, e.g.: 8 | * 9 |

This here is a pill!

10 | * 11 |

This here is also a lozenge!

12 | * 13 | * Pills have fully rounded ends, lozenges have only their corners rounded. 14 | * 15 | * Demo: jsfiddle.net/inuitcss/N3pGm 16 | * 17 | */ 18 | .pill{ 19 | display:inline-block; 20 | /** 21 | * These numbers set in ems mean that, at its narrowest, a lozenge will be 22 | * the same width as the `line-height` set on the `html` element. 23 | * This allows us to use the `.loz` in almost any `font-size` we wish. 24 | */ 25 | min-width: ($line-height-ratio * 0.666667) * 1em; 26 | padding-right:($line-height-ratio * 0.166667) * 1em; 27 | padding-left: ($line-height-ratio * 0.166667) * 1em; 28 | /* =1.50em */ 29 | text-align:center; 30 | background-color:$base-ui-color; 31 | color:#fff; /* Override this color in your theme stylesheet */ 32 | 33 | /** 34 | * Normally we’d use border-radius:100%; but instead here we just use an 35 | * overly large number; `border-radius:100%;` would create an oval on 36 | * non-square elements whereas we just want to round the ends of an element. 37 | */ 38 | border-radius:100px; 39 | } 40 | 41 | .loz{ 42 | @extend .pill; 43 | border-radius:$brand-round; 44 | } 45 | 46 | }//endif 47 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_marginalia.scss: -------------------------------------------------------------------------------- 1 | @if $use-marginalia == true{ 2 | 3 | /*------------------------------------*\ 4 | $MARGINALIA 5 | \*------------------------------------*/ 6 | /** 7 | * Marginalia are, per definition, notes in the margin of a document. The 8 | * `marginalia__body` class can be applied to all kinds of content, like text or 9 | * images, and is joined by a width class: 10 | * 11 |
12 |
13 |
14 | * 15 | * Demo: jsfiddle.net/inuitcss/AemkH 16 | * 17 | */ 18 | .marginalia{ 19 | @include font-size($milli-size); 20 | } 21 | 22 | /** 23 | * Wait for a certain breakpoint to trigger ‘proper' marginalia. Up to this point, 24 | * marginalia are inline with the other text. 25 | */ 26 | @media (min-width: $desk-start){ 27 | .marginalia{ 28 | position:relative; 29 | } 30 | 31 | .marginalia__body, 32 | .marginalia__body--right{ 33 | position:absolute; 34 | } 35 | 36 | .marginalia__body{ 37 | right:100%; 38 | padding-right:$base-spacing-unit; 39 | text-align:right; 40 | } 41 | 42 | /** 43 | * Align marginalia to the right of the text. 44 | */ 45 | .marginalia__body--right{ 46 | left:100%; 47 | padding-left:$base-spacing-unit; 48 | text-align:left; 49 | } 50 | } 51 | 52 | }//endif 53 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_media.scss: -------------------------------------------------------------------------------- 1 | @if $use-media == true{ 2 | 3 | /*------------------------------------*\ 4 | $MEDIA 5 | \*------------------------------------*/ 6 | /** 7 | * Place any image- and text-like content side-by-side, as per: 8 | * stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code 9 | * E.g.: 10 | * 11 |
12 | 13 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, 14 | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

15 |
16 | * 17 | * Demo: jsfiddle.net/inuitcss/cf4Qs 18 | * 19 | */ 20 | .media{ 21 | display:block; 22 | @extend .cf; 23 | } 24 | .media__img{ 25 | float:left; 26 | margin-right:$base-spacing-unit; 27 | } 28 | /** 29 | * Reversed image location (right instead of left). 30 | */ 31 | .media__img--rev{ 32 | float:right; 33 | margin-left:$base-spacing-unit; 34 | } 35 | 36 | .media__img img, 37 | .media__img--rev img{ 38 | display:block; 39 | } 40 | 41 | .media__body{ 42 | overflow:hidden; 43 | } 44 | .media__body, 45 | .media__body > :last-child{ 46 | margin-bottom:0; 47 | } 48 | 49 | 50 | /** 51 | * `.img`s in `.islet`s need an appropriately sized margin. 52 | */ 53 | .islet .media__img{ 54 | margin-right:$half-spacing-unit; 55 | } 56 | .islet .media__img--rev{ 57 | margin-left:$half-spacing-unit; 58 | } 59 | 60 | }//endif 61 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_options.scss: -------------------------------------------------------------------------------- 1 | @if $use-options == true{ 2 | 3 | /*------------------------------------*\ 4 | $OPTIONS 5 | \*------------------------------------*/ 6 | /** 7 | * Link-group nav, used for displaying related options. Extends `.nav--block` 8 | * but could also extend `.nav--fit`. Extend with colours and ‘current states’ 9 | * in your theme stylesheet. 10 | * 11 | 17 | * 18 | * Demo: jsfiddle.net/inuitcss/vwfaf 19 | * 20 | */ 21 | .options{ 22 | @extend .nav--block; 23 | 24 | > li{ 25 | 26 | > a{ 27 | border:0 solid $base-ui-color; 28 | border-width:1px; 29 | border-left-width:0; 30 | } 31 | 32 | &:first-child > a{ 33 | border-left-width:1px; 34 | border-top-left-radius:$brand-round; 35 | border-bottom-left-radius:$brand-round; 36 | } 37 | 38 | &:last-child > a{ 39 | border-top-right-radius:$brand-round; 40 | border-bottom-right-radius:$brand-round; 41 | } 42 | } 43 | } 44 | 45 | }//endif 46 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_pagination.scss: -------------------------------------------------------------------------------- 1 | @if $use-pagination == true{ 2 | 3 | /*------------------------------------*\ 4 | $PAGINATION 5 | \*------------------------------------*/ 6 | /** 7 | * Basic pagination object, extends `.nav`. 8 | * Requires some funky commenting to collapse any white-space caused by the 9 | * `display:inline-block;` rules. 10 | * 11 | 22 | * 23 | * Demo: jsfiddle.net/inuitcss/9Y6PU 24 | * 25 | */ 26 | .pagination{ 27 | text-align:center; 28 | /** 29 | * Remove whitespace caused by `inline-block`. 30 | */ 31 | letter-spacing:-0.31em; 32 | word-spacing:-0.43em; 33 | } 34 | .pagination > li{ 35 | padding:$base-spacing-unit / 2; 36 | letter-spacing:normal; 37 | word-spacing:normal; 38 | } 39 | .pagination > li > a{ 40 | padding:$base-spacing-unit / 2; 41 | margin:-$base-spacing-unit / 2; 42 | } 43 | .pagination__first a:before{ 44 | content:"\00AB" "\00A0"; 45 | } 46 | .pagination__last a:after{ 47 | content:"\00A0" "\00BB"; 48 | } 49 | 50 | }//endif 51 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_rules.scss: -------------------------------------------------------------------------------- 1 | @if $use-rules == true{ 2 | 3 | /*------------------------------------*\ 4 | $RULES 5 | \*------------------------------------*/ 6 | /** 7 | * Horizontal rules, extend `hr`. 8 | * 9 | * Demo: jsfiddle.net/inuitcss/L6GuZ 10 | * 11 | */ 12 | .rule{ 13 | color:$base-ui-color; 14 | border:none; 15 | border-bottom-width:1px; 16 | border-bottom-style:solid; 17 | margin-bottom:$base-spacing-unit - 1px; 18 | margin-bottom:(($base-spacing-unit - 1px) / $base-font-size)*1rem; 19 | } 20 | 21 | 22 | /** 23 | * Dotted rules 24 | */ 25 | .rule--dotted{ 26 | border-bottom-style:dotted; 27 | } 28 | 29 | 30 | /** 31 | * Dashed rules 32 | */ 33 | .rule--dashed{ 34 | border-bottom-style:dashed; 35 | } 36 | 37 | 38 | /** 39 | * Ornamental rules. Places a § over the rule. 40 | */ 41 | .rule--ornament{ 42 | position:relative; 43 | 44 | &:after{ 45 | content:"\00A7"; 46 | position:absolute; 47 | top: 0; 48 | right: 0; 49 | left: 0; 50 | line-height:0; 51 | text-align:center; 52 | } 53 | 54 | /** 55 | * Pass in an arbitrary ornament though a data attribute, e.g.: 56 | * 57 |
58 | * 59 | */ 60 | &[data-ornament]:after{ 61 | content:attr(data-ornament); 62 | } 63 | } 64 | 65 | }//endif 66 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_split.scss: -------------------------------------------------------------------------------- 1 | @if $use-split == true{ 2 | 3 | /*------------------------------------*\ 4 | $SPLIT 5 | \*------------------------------------*/ 6 | /** 7 | * Simple split item for creating two elements floated away from one another, 8 | * e.g.: 9 | * 10 |
11 |
Burger and fries
12 |
£5.99
13 |
Fillet steak
14 |
£19.99
15 |
Ice cream
16 |
£2.99
17 |
18 | * 19 |
    20 |
  1. 1st place Bob
  2. 21 |
  3. 2nd place Lilly
  4. 22 |
  5. 3rd place Ted
  6. 23 |
​ 24 | * 25 | * Demo: jsfiddle.net/inuitcss/9gZW7 26 | * 27 | */ 28 | .split{ 29 | text-align:right; 30 | list-style:none; 31 | margin-left:0; 32 | } 33 | .split__title{ 34 | text-align:left; 35 | float:left; 36 | clear:left; 37 | } 38 | 39 | }//endif 40 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_stats.scss: -------------------------------------------------------------------------------- 1 | @if $use-stats == true{ 2 | 3 | /*------------------------------------*\ 4 | $STATS 5 | \*------------------------------------*/ 6 | /** 7 | * Simple object to display key–value statistic-like information, e.g.: 8 | * 9 |
10 |
11 |
Tweets
12 |
27,740
13 |
14 | 15 |
16 |
Following
17 |
11,529
18 |
19 | 20 |
21 |
Followers
22 |
12,105
23 |
24 |
25 | * 26 | * Demo: jsfiddle.net/inuitcss/Bpwu6 27 | * 28 | */ 29 | .stat-group{ 30 | @extend .cf; 31 | margin-left:-$base-spacing-unit; 32 | } 33 | .stat{ 34 | float:left; 35 | margin-left:$base-spacing-unit; 36 | display:-ms-flexbox; 37 | display:-webkit-flex; 38 | display: -moz-flex; 39 | display: flex; 40 | @include vendor(flex-direction, column); 41 | } 42 | .stat__title{ 43 | @include vendor(order, 2); 44 | -ms-flex-order:2; 45 | } 46 | .stat__value{ 47 | margin-left:0; 48 | @include vendor(order, 1); 49 | -ms-flex-order:1; 50 | } 51 | 52 | }//endif 53 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/inuit.css/objects/_this-or-this.scss: -------------------------------------------------------------------------------- 1 | @if $use-this-or-this == true{ 2 | 3 | /*------------------------------------*\ 4 | $THIS-OR-THIS 5 | \*------------------------------------*/ 6 | /** 7 | * Simple options object to provide multiple choices, e.g.: 8 | * 9 |

10 | 11 | Free 12 | 13 | 14 | or 15 | 16 | 17 | Pro 18 | 19 |

20 | * 21 | * The `.this-or-this__this` and `.this-or-this__or` objects can be sized using 22 | * the grid-system classes. 23 | * 24 | * Demo: jsfiddle.net/inuitcss/R3sks 25 | * 26 | */ 27 | .this-or-this{ 28 | display:table; 29 | width:100%; 30 | text-align:center; 31 | } 32 | .this-or-this__this, 33 | .this-or-this__or{ 34 | display:table-cell; 35 | vertical-align:middle; 36 | } 37 | 38 | }//endif 39 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/style.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /*------------------------------------*\ 3 | STYLE.CSS 4 | \*------------------------------------*/ 5 | /** 6 | * 7 | * sass --watch style.scss:style.min.css --style compressed 8 | * 9 | * Here we pull in some variables, include the inuit.css framework, then add our 10 | * project-specific components afterwards. 11 | */ 12 | 13 | 14 | /** 15 | * Setup 16 | */ 17 | @import "vars"; 18 | @import "inuit.css/inuit"; 19 | 20 | 21 | 22 | 23 | 24 | /** 25 | * Shes all yours, capn... Begin importing your stuff here. 26 | */ 27 | //@import "ui/example"; -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Inuit/test.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /*------------------------------------*\ 3 | STYLE.CSS 4 | \*------------------------------------*/ 5 | /** 6 | * 7 | * sass --watch style.scss:style.min.css --style compressed 8 | * 9 | * Here we pull in some variables, include the inuit.css framework, then add our 10 | * project-specific components afterwards. 11 | */ 12 | 13 | @import "vars"; 14 | 15 | body {font-weight:bold;} -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/MyFirstLess.css: -------------------------------------------------------------------------------- 1 | h5 { 2 | color: #cc0000; 3 | } 4 | h2 { 5 | color: #cc0000; 6 | } 7 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/MyFirstLess.less: -------------------------------------------------------------------------------- 1 | @import "testless1.less"; 2 | @import "SubFolder/testless2.less"; 3 | @import url(SubFolder/testless3.less); 4 | @import url(/Css/SubFolder/testless4.less); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/MyFirstLess.min.css: -------------------------------------------------------------------------------- 1 | h5{color:#c00}h2{color:#c00} -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/MyFirstSass.sass: -------------------------------------------------------------------------------- 1 | table.hl 2 | margin: 2em 0 3 | td.ln 4 | text-align: right 5 | 6 | span.highlight 7 | font: 8 | family: serif 9 | weight: bold 10 | size: 1.2em -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/MyFirstScss.scss: -------------------------------------------------------------------------------- 1 | $blue: #3bbfce; 2 | $margin: 16px; 3 | 4 | .content-navigation { 5 | border-color: $blue; 6 | color: 7 | darken($blue, 9%); 8 | } 9 | 10 | .border { 11 | padding: $margin / 2; 12 | margin: $margin / 2; 13 | border-color: $blue; 14 | border-style:solid; 15 | border-width:2px; 16 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/OverrideStyles.css: -------------------------------------------------------------------------------- 1 | html body 2 | { 3 | background-color:#DFF0CB ! important; 4 | } 5 | 6 | html body *.bg-primary-1 { background-color: #DFF0CB ! important; } 7 | html body *.bg-primary-2 { background-color: #A5AE9A ! important; } 8 | html body *.bg-primary-3 { background-color: #6A9338 ! important; } 9 | html body *.bg-primary-4 { background-color: #E9F6D8 ! important; } 10 | html body *.bg-primary-5 { background-color: #ECF6DE ! important; } 11 | 12 | html body *.bg-complement-1 { background-color: #E8C4D2 ! important; } 13 | html body *.bg-complement-2 { background-color: #A8959C ! important; } 14 | html body *.bg-complement-3 { background-color: #8E365A ! important; } 15 | html body *.bg-complement-4 { background-color: #F1D4E0 ! important; } 16 | html body *.bg-complement-5 { background-color: #F1DAE3 ! important;} 17 | 18 | html body *.f-primary-1 { color: #DFF0CB ! important; } 19 | html body *.f-primary-2 { color: #A5AE9A ! important; } 20 | html body *.f-primary-3 { color: #6A9338 ! important; } 21 | html body *.f-primary-4 { color: #E9F6D8 ! important; } 22 | html body *.f-primary-5 { color: #ECF6DE ! important; } 23 | 24 | html body *.f-complement-1 { color: #E8C4D2 ! important; } 25 | html body *.f-complement-2 { color: #A8959C ! important; } 26 | html body *.f-complement-3 { color: #8E365A ! important; } 27 | html body *.f-complement-4 { color: #F1D4E0 ! important; } 28 | html body *.f-complement-5 { color: #F1DAE3 ! important;} 29 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Print.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | background:white; 4 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/SubFolder/testless2.less: -------------------------------------------------------------------------------- 1 | h5 { 2 | color: @brand_color; 3 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/SubFolder/testless3.less: -------------------------------------------------------------------------------- 1 | h2 { 2 | color: @brand_color; 3 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/SubFolder/testless4.css: -------------------------------------------------------------------------------- 1 | h2 { 2 | font-style: italic; 3 | } 4 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/SubFolder/testless4.less: -------------------------------------------------------------------------------- 1 | h2 { 2 | font-style:italic; 3 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/Test.css: -------------------------------------------------------------------------------- 1 | .lazyLoaded {color: #8E365A; font-size: 28px;} -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/TestPath/BodyGradient.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: -webkit-gradient( 3 | linear, 4 | left bottom, 5 | left top, 6 | color-stop(0.2, rgb(99,194,21)), 7 | color-stop(0.53, rgb(229,235,47)), 8 | color-stop(0.75, rgb(210,238,249)) 9 | ); 10 | background-image: -moz-linear-gradient( 11 | center bottom, 12 | rgb(99,194,21) 20%, 13 | rgb(229,235,47) 53%, 14 | rgb(210,238,249) 75% 15 | ); 16 | 17 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/testless1.css: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Css/testless1.less: -------------------------------------------------------------------------------- 1 | @brand_color: #CC00FA; -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ClientDependency.Web.Test.Default" %> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
Pick your poison
16 | 17 | 18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Default.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test 9 | { 10 | public partial class Default : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Default.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ClientDependency.Web.Test { 11 | 12 | 13 | public partial class Default { 14 | 15 | /// 16 | /// form1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::System.Web.UI.HtmlControls.HtmlForm form1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="ClientDependency.Web.Test.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Images/header.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Web.Test/Images/header.gif -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/AnotherTest.js: -------------------------------------------------------------------------------- 1 | alert("Another test!"); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/EncodingTestANSI.js: -------------------------------------------------------------------------------- 1 | function ANSIEncoding() { 2 | alert("Testing ANSI encoding"); 3 | } 4 | ANSIEncoding(); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/EncodingTestUCS2BigEndian.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Web.Test/Js/EncodingTestUCS2BigEndian.js -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/EncodingTestUCS2LittleEndian.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/ClientDependency.Web.Test/Js/EncodingTestUCS2LittleEndian.js -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/EncodingTestUTF8.js: -------------------------------------------------------------------------------- 1 | function UTF8Encoding() { 2 | alert("Testing UTF8 encoding with BOM"); 3 | } 4 | UTF8Encoding(); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/EncodingTestUTF8WithoutBOM.js: -------------------------------------------------------------------------------- 1 | function UTF8EncodingWithoutBOM() { 2 | alert("Testing UTF8 encoding file without BOM"); 3 | } 4 | UTF8EncodingWithoutBOM(); 5 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/FooterScript.js: -------------------------------------------------------------------------------- 1 | (function(txt) { 2 | if (!$.isReady) { 3 | $(document).ready(function() { 4 | writeFooterStuff(); 5 | }); 6 | } 7 | else { 8 | writeFooterStuff(); 9 | } 10 | })(); 11 | function writeFooterStuff() { 12 | var letters = "Hello footer"; 13 | 14 | var counter = 0; 15 | $(".footer").html($(".footer").html() + "
"); 16 | var timer = setInterval(function() { 17 | $(".footer").html($(".footer").html() + letters[counter]); 18 | counter++; 19 | if (counter == letters.length) { 20 | clearInterval(timer); 21 | } 22 | }, 50); 23 | 24 | for (var c in letters) { 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/HtmlIncludeTest1.js: -------------------------------------------------------------------------------- 1 | alert("HtmlInclude test 1"); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/HtmlIncludeTest2.js: -------------------------------------------------------------------------------- 1 | alert("HtmlInclude test 2"); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/JQueryTemplate.js: -------------------------------------------------------------------------------- 1 | 
2 |
-------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/JsFromAspx.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Title="Title" Language="C#" %> 2 | alert("from aspx!"); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/Libs/inputmask/inputmask.dependencyLib.jquery.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * inputmask.dependencyLib.jquery.js 3 | * https://github.com/RobinHerbots/jquery.inputmask 4 | * Copyright (c) 2010 - 2016 Robin Herbots 5 | * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 6 | * Version: 3.3.1 7 | */ 8 | !function(factory) { 9 | "function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery); 10 | }(function($) { 11 | return window.dependencyLib = $, $; 12 | }); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/Libs/inputmask_min/inputmask.dependencyLib.jquery.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * inputmask.dependencyLib.jquery.min.js 3 | * http://github.com/RobinHerbots/jquery.inputmask 4 | * Copyright (c) 2010 - 2015 Robin Herbots 5 | * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 6 | * Version: 3.2.3 7 | */ 8 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return window.dependencyLib=a,a}); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/Libs/inputmask_min/inputmask.phone.extensions.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * inputmask.phone.extensions.min.js 3 | * http://github.com/RobinHerbots/jquery.inputmask 4 | * Copyright (c) 2010 - 2015 Robin Herbots 5 | * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 6 | * Version: 3.2.3 7 | */ 8 | !function(a){"function"==typeof define&&define.amd?define(["jquery","inputmask"],a):"object"==typeof exports?module.exports=a(require("jquery"),require("./inputmask")):a(jQuery,window.Inputmask)}(function(a,b){return b.extendAliases({phone:{url:"phone-codes/phone-codes.js",countrycode:"",mask:function(b){b.definitions["#"]=b.definitions[9];var c=[];return a.ajax({url:b.url,async:!1,dataType:"json",success:function(a){c=a},error:function(a,c,d){alert(d+" - "+b.url)}}),c=c.sort(function(a,b){return(a.mask||a)<(b.mask||b)?-1:1})},keepStatic:!1,nojumps:!0,nojumpsThreshold:1,onBeforeMask:function(a,b){var c=a.replace(/^0/g,"");return(c.indexOf(b.countrycode)>1||-1===c.indexOf(b.countrycode))&&(c="+"+b.countrycode+c),c}},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",countrycode:"32",nojumpsThreshold:4}}),b}); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/MessageService.js: -------------------------------------------------------------------------------- 1 | var Messaging = { 2 | GetMessage: function(callback) { 3 | $.ajax({ 4 | type: "POST", 5 | url: "/Services/MessageService.asmx/HelloWorld", 6 | data: "{}", 7 | contentType: "application/json; charset=utf-8", 8 | dataType: "json", 9 | success: function(msg) { 10 | callback.apply(this, [msg.d]); 11 | } 12 | }); 13 | } 14 | }; -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/MyFirstCoffee.coffee: -------------------------------------------------------------------------------- 1 | # CoffeeScript 2 | square = (x) -> x * x 3 | cube = (x) -> square(x) * x 4 | alert(square 2 * cube 2); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/MyFirstCoffee.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var cube, square; 3 | 4 | square = function(x) { 5 | return x * x; 6 | }; 7 | 8 | cube = function(x) { 9 | return square(x) * x; 10 | }; 11 | 12 | alert(square(2 * cube(2))); 13 | 14 | }).call(this); 15 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/MyFirstCoffee.min.js: -------------------------------------------------------------------------------- 1 | (function(){var t,n;n=function(n){return n*n},t=function(t){return n(t)*t},alert(n(2*t(2)))}).call(this) -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/MyFirstTypeScript.ts: -------------------------------------------------------------------------------- 1 | function greeter(person: string) { 2 | return "Hello, " + person; 3 | } 4 | var user = "Jane User"; 5 | alert(greeter(user)); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/RogueScript1.js: -------------------------------------------------------------------------------- 1 | setTimeout(function() { 2 | writeStuff("I'm a rogue script and my rogue friend has made the header blink"); 3 | } 4 | , 2000); 5 | 6 | function writeStuff(str) { 7 | var letters = str; 8 | var counter = 0; 9 | $(".myControl div").html(""); 10 | $(".myControl div").css("color", "blue").css("font-size", "20px").css("padding", "10px"); 11 | var timer = setInterval(function() { 12 | $(".myControl div").html($(".myControl div").html() + letters[counter]); 13 | counter++; 14 | if (counter == letters.length) { 15 | clearInterval(timer); 16 | } 17 | }, 50); 18 | 19 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/RogueScript2.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | var fader = { 3 | fadeOut: function() { 4 | var _this = this; 5 | $(".control.header").fadeOut(1000, function() { _this.fadeIn.call(_this) }) 6 | .effect("highlight"); 7 | }, 8 | fadeIn: function() { 9 | var _this = this; 10 | $(".control.header").fadeIn(1000, function() { _this.fadeOut.call(_this) }) 11 | .effect("highlight"); 12 | } 13 | }; 14 | fader.fadeOut(); 15 | }); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/SomeLazyLoadScript.js: -------------------------------------------------------------------------------- 1 | function doSomething() { 2 | 3 | if (!$ && !$.isReady) { 4 | $(document).ready(function() { 5 | writeStuff(); 6 | }); 7 | } 8 | else { 9 | writeStuff(); 10 | } 11 | } 12 | function writeStuff() { 13 | var letters = "--------LAZY LOADED!----------"; 14 | 15 | var counter = 0; 16 | $(".footer").html($(".footer").html() + "
"); 17 | var timer = setInterval(function() { 18 | $(".lazyLoaded").html($(".lazyLoaded").html() + letters[counter]); 19 | counter++; 20 | if (counter == letters.length) { 21 | clearInterval(timer); 22 | } 23 | }, 50); 24 | 25 | } 26 | doSomething(); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Js/TestPath/HeaderOrange.js: -------------------------------------------------------------------------------- 1 | (function ($) { 2 | 3 | $(document).ready(function () { 4 | 5 | $(".header").css("background-color", "orange"); 6 | $(".header").css("background-image", "none"); 7 | 8 | }); 9 | 10 | })(jQuery); -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Models/TestModel.cs: -------------------------------------------------------------------------------- 1 | namespace ClientDependency.Web.Test.Models 2 | { 3 | 4 | public class TestModel 5 | { 6 | 7 | public string Heading { get; set; } 8 | public string BodyContent { get; set; } 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/Default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ClientDependency.Web.Test.Pages._Default" %> 2 | 3 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 4 | 5 | 6 | 7 |
8 |

9 | Using the default provider specified in the web.config

10 |

11 | Nothing fancy here, just rendering the script and style blocks using the default provider. 12 | This library ships with the LoaderControlProvider set to the default 13 | provider which will render the script/style blocks where the ClientDependencyLoader is placed in page/control markup.

14 |

15 | This paragraph is styled using a relative css path 16 |

17 |
18 |
19 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/Default.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Pages 9 | { 10 | public partial class _Default : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | HttpResponse Response = HttpContext.Current.Response; 15 | Response.Clear(); 16 | Response.Filter = new System.IO.Compression.GZipStream(Response.Filter, System.IO.Compression.CompressionMode.Compress); 17 | Response.AppendHeader("Content-Encoding", "gzip"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/Default.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.4927 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ClientDependency.Web.Test.Pages { 12 | 13 | 14 | public partial class _Default { 15 | 16 | /// 17 | /// CssInclude1 control. 18 | /// 19 | /// 20 | /// Auto-generated field. 21 | /// To modify move field declaration from designer file to code-behind file. 22 | /// 23 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; 24 | 25 | /// 26 | /// CssInclude2 control. 27 | /// 28 | /// 29 | /// Auto-generated field. 30 | /// To modify move field declaration from designer file to code-behind file. 31 | /// 32 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude2; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/DependencyGroups.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="DependencyGroups.aspx.cs" Inherits="ClientDependency.Web.Test.Pages.DependencyGroups" %> 2 | 3 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |

12 | Dependency groups

13 |

14 | On this page, we've got the jquery libraries grouped so that they are shared across pages, other dependencies are loaded normally.

15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/DependencyGroups.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Pages 9 | { 10 | public partial class DependencyGroups : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/EmbeddedResourceTest.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="EmbeddedResourceTest.aspx.cs" Inherits="ClientDependency.Web.Test.Pages.EmbeddedResourceTest" %> 2 | 3 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 4 | 5 | 6 | 7 |
8 |

9 | Registering an embedded resource via ClientDependency!

10 |

11 | This font is big because an embedded style resource has been added to the ClientDependency output 12 |

13 |
14 |
15 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/EmbeddedResourceTest.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | using ClientDependency.Core.Controls; 8 | 9 | [assembly: WebResource("ClientDependency.Web.Test.Pages.embedded.css", "text/css")] 10 | 11 | namespace ClientDependency.Web.Test.Pages 12 | { 13 | 14 | public partial class EmbeddedResourceTest : Page 15 | { 16 | protected void Page_Load(object sender, EventArgs e) 17 | { 18 | 19 | var http = new HttpContextWrapper(Context); 20 | 21 | var embeddedCssPath = Page.ClientScript.GetWebResourceUrl(typeof(EmbeddedResourceTest), "ClientDependency.Web.Test.Pages.embedded.css"); 22 | 23 | //embed the web resource! sweeet. 24 | ClientDependencyLoader.GetInstance(http).RegisterDependency(embeddedCssPath, Core.ClientDependencyType.Css); 25 | 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/EmbeddedResourceTest.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ClientDependency.Web.Test.Pages { 11 | 12 | 13 | public partial class EmbeddedResourceTest { 14 | 15 | /// 16 | /// CssInclude1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; 23 | 24 | /// 25 | /// CssInclude2 control. 26 | /// 27 | /// 28 | /// Auto-generated field. 29 | /// To modify move field declaration from designer file to code-behind file. 30 | /// 31 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude2; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/EncodingTest.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Pages 9 | { 10 | public partial class EncodingTest : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/ForcedProviders.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | using ClientDependency.Core.Controls; 8 | using ClientDependency.Core.FileRegistration.Providers; 9 | using ClientDependency.Core; 10 | 11 | namespace ClientDependency.Web.Test.Pages 12 | { 13 | public partial class FocedProviders : System.Web.UI.Page 14 | { 15 | protected void Page_Load(object sender, EventArgs e) 16 | { 17 | var http = new HttpContextWrapper(Context); 18 | 19 | //dynamically register the dependency 20 | ClientDependencyLoader.GetInstance(http).RegisterDependency("Content.css", "Styles", ClientDependencyType.Css); 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/ForcedProviders.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ClientDependency.Web.Test.Pages { 11 | 12 | 13 | public partial class FocedProviders { 14 | 15 | /// 16 | /// CssInclude2 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude2; 23 | 24 | /// 25 | /// JsInclude1 control. 26 | /// 27 | /// 28 | /// Auto-generated field. 29 | /// To modify move field declaration from designer file to code-behind file. 30 | /// 31 | protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; 32 | 33 | /// 34 | /// CssInclude1 control. 35 | /// 36 | /// 37 | /// Auto-generated field. 38 | /// To modify move field declaration from designer file to code-behind file. 39 | /// 40 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/HtmlAttributes.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="HtmlAttributes.aspx.cs" Inherits="ClientDependency.Web.Test.Pages.HtmlAttributes" %> 2 | 3 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 | Testing some custom Html attributes on script/link tags

12 |

13 | Here were rendering out a stylesheet that has a media="print" attribute and a JS file that has a type="text/html" attribute (for things like jquery templates)

14 |
15 |
16 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/HtmlAttributes.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Pages 9 | { 10 | public partial class HtmlAttributes : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/HtmlIncludeTest.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="HtmlIncludeTest.aspx.cs" Inherits="ClientDependency.Web.Test.Pages.HtmlIncludeTest" %> 2 | 3 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |

15 | Test using the HtmlInclude control to register CSS and JS includes

16 |

17 | On this page multiple includes of type CSS and JS are being loaded using the HtmlInclude control 18 | which parses regular HTML include tags to find dependencies.

19 |

20 | This paragraph is styled using a relative css path 21 |

22 |
23 |
24 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/HtmlIncludeTest.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Pages 9 | { 10 | public partial class HtmlIncludeTest : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/HtmlIncludeTest.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ClientDependency.Web.Test.Pages { 11 | 12 | 13 | public partial class HtmlIncludeTest { 14 | 15 | /// 16 | /// CssInclude1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; 23 | 24 | /// 25 | /// CssInclude2 control. 26 | /// 27 | /// 28 | /// Auto-generated field. 29 | /// To modify move field declaration from designer file to code-behind file. 30 | /// 31 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude2; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/JSONCompressionTest.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Pages 9 | { 10 | public partial class JSONCompressionTest : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/LazyLoadProvider.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="LazyLoadProvider.aspx.cs" Inherits="ClientDependency.Core.Web.Test.Pages.LazyLoadProvider" %> 2 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 3 | 4 | 5 |
6 |

7 | Using the Lazy Load Provider and dynamically registering my css file in the code behind.

8 |

9 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sed lorem viverra magna molestie vestibulum ac non risus. Sed sed leo quam, eu eleifend neque. Curabitur ultricies metus a lectus aliquam tempus. Integer in metus a nibh tincidunt fermentum. In nec purus vitae nunc rhoncus eleifend. Etiam placerat consectetur enim ac pharetra. Etiam et nisi orci, lobortis eleifend erat. Praesent ac metus metus, id luctus neque. Mauris dictum ultricies nisi vel sodales. Nunc vestibulum quam vel eros egestas dapibus. Ut aliquet turpis metus. Curabitur libero ligula, ullamcorper in volutpat non, gravida ac erat. Praesent sed nibh at tortor mattis commodo vitae vitae tortor.

10 |
11 |
-------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/LazyLoadProvider.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | using ClientDependency.Core.Controls; 8 | using ClientDependency.Core.Providers; 9 | 10 | namespace ClientDependency.Core.Web.Test.Pages 11 | { 12 | public partial class LazyLoadProvider : System.Web.UI.Page 13 | { 14 | protected void Page_Load(object sender, EventArgs e) 15 | { 16 | //Changes the provider to be used at runtime 17 | ClientDependencyLoader.Instance.ProviderName = ClientSideRegistrationProvider.DefaultName; 18 | 19 | //dynamically register the dependency 20 | ClientDependencyLoader.Instance.RegisterDependency("Content.css", "Styles", ClientDependencyType.Css); 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/LazyLoadProvider.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.3053 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ClientDependency.Core.Web.Test.Pages { 12 | 13 | 14 | public partial class LazyLoadProvider { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/LazyLoadProviderTest.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="LazyLoadProviderTest.aspx.cs" Inherits="ClientDependency.Web.Test.Pages.LazyLoadProviderTest" %> 2 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 3 | 4 | 5 |
6 |

7 | Using the Lazy Load Provider and dynamically registering my css file in the code behind.

8 |

9 | This example actually changes the current request's ClientDependencyLoader's default provider at runtime to the LazyLoadProvider

10 |

11 | //Changes the provider to be used at runtime in the code behind
12 | ClientDependencyLoader.Instance.ProviderName = LazyLoadProvider.DefaultName;

13 |

14 | //dynamically register the dependency in the code behind
15 | ClientDependencyLoader.Instance.RegisterDependency("Content.css", "Styles", ClientDependencyType.Css);

16 |
17 |
-------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/LazyLoadProviderTest.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | using ClientDependency.Core.Controls; 8 | using ClientDependency.Core.FileRegistration.Providers; 9 | using ClientDependency.Core; 10 | 11 | namespace ClientDependency.Web.Test.Pages 12 | { 13 | public partial class LazyLoadProviderTest : System.Web.UI.Page 14 | { 15 | protected void Page_Load(object sender, EventArgs e) 16 | { 17 | var http = new HttpContextWrapper(Context); 18 | 19 | //Changes the provider to be used at runtime 20 | ClientDependencyLoader.GetInstance(http).ProviderName = LazyLoadProvider.DefaultName; 21 | 22 | //dynamically register the dependency 23 | ClientDependencyLoader.GetInstance(http).RegisterDependency("Content.css", "Styles", ClientDependencyType.Css); 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/LazyLoadProviderTest.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.4927 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ClientDependency.Web.Test.Pages { 12 | 13 | 14 | public partial class LazyLoadProviderTest { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/Master.Master.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace ClientDependency.Web.Test.Pages 9 | { 10 | public partial class Master : System.Web.UI.MasterPage 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | Loader.DataBind(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/RemoteDependencies.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Master.Master" AutoEventWireup="true" CodeBehind="RemoteDependencies.aspx.cs" Inherits="ClientDependency.Web.Test.Pages.RemoteDependencies " %> 2 | <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |

13 | Some dependencies are from remote servers

14 |

15 | On this page, we've got the jquery library loaded from our local server with a priority of "1", but we've got the jquery UI registered with a file 16 | path from the Google CDN with a priority of "3". 17 |

18 |

19 | In the source of this page, ClientDependency has split the registrations for JavaScript so that everthing found before the jQuery UI lib is compressed, combined, etc.. 20 | then the jQuery UI lib is registered for downloading from the CDN, then everything after is again compressed, combined, etc... 21 |

22 |
23 |
-------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/RemoteDependencies.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | using ClientDependency.Core.Controls; 8 | using ClientDependency.Core.FileRegistration.Providers; 9 | using ClientDependency.Core; 10 | 11 | namespace ClientDependency.Web.Test.Pages 12 | { 13 | public partial class RemoteDependencies : System.Web.UI.Page 14 | { 15 | protected void Page_Load(object sender, EventArgs e) 16 | { 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/RemoteDependencies.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ClientDependency.Web.Test.Pages { 11 | 12 | 13 | public partial class RemoteDependencies { 14 | 15 | /// 16 | /// JsInclude1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; 23 | 24 | /// 25 | /// CssInclude1 control. 26 | /// 27 | /// 28 | /// Auto-generated field. 29 | /// To modify move field declaration from designer file to code-behind file. 30 | /// 31 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/RogueScriptDetectionTest.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | using ClientDependency.Core.Controls; 8 | 9 | namespace ClientDependency.Web.Test.Pages 10 | { 11 | public partial class RogueScriptDetectionTest : System.Web.UI.Page 12 | { 13 | protected void Page_Load(object sender, EventArgs e) 14 | { 15 | //dynamically change the provider for this page 16 | ClientDependencyLoader.GetInstance(new HttpContextWrapper(this.Context)) 17 | .ProviderName = "LoaderControlProvider"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/RogueScriptDetectionTest.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.4927 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ClientDependency.Web.Test.Pages { 12 | 13 | 14 | public partial class RogueScriptDetectionTest { 15 | 16 | /// 17 | /// CssInclude1 control. 18 | /// 19 | /// 20 | /// Auto-generated field. 21 | /// To modify move field declaration from designer file to code-behind file. 22 | /// 23 | protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/embedded.css: -------------------------------------------------------------------------------- 1 | body{} 2 | p 3 | { 4 | font-size:30px !important; 5 | font-weight:bold !important; 6 | } 7 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Pages/relative.css: -------------------------------------------------------------------------------- 1 | .red 2 | { 3 | color:Red; 4 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClientDependency.Web.Test")] 9 | [assembly: AssemblyDescription("Demo web site for testing and demonstrating ClientDependency usage")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyProduct("ClientDependency.Web.Test")] 12 | 13 | // Setting ComVisible to false makes the types in this assembly not visible 14 | // to COM components. If you need to access a type in this assembly from 15 | // COM, set the ComVisible attribute to true on that type. 16 | [assembly: ComVisible(false)] 17 | 18 | // The following GUID is for the ID of the typelib if this project is exposed to COM 19 | [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] 20 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Services/MessageService.asmx: -------------------------------------------------------------------------------- 1 | <%@ WebService Language="C#" CodeBehind="MessageService.asmx.cs" Class="ClientDependency.Web.Test.Services.MessageService" %> 2 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Services/MessageService.asmx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Services; 6 | using System.Web.Script.Services; 7 | 8 | namespace ClientDependency.Web.Test.Services 9 | { 10 | /// 11 | /// Summary description for MessageService 12 | /// 13 | [WebService(Namespace = "http://tempuri.org/")] 14 | [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 15 | [System.ComponentModel.ToolboxItem(false)] 16 | [ScriptService] 17 | public class MessageService : System.Web.Services.WebService 18 | { 19 | 20 | [WebMethod] 21 | public string HelloWorld() 22 | { 23 | return "Hello World from the Message Service!"; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/TestLogger.cs: -------------------------------------------------------------------------------- 1 | using Serilog; 2 | using System; 3 | using System.Web; 4 | using System.Web.Hosting; 5 | 6 | namespace ClientDependency.Web.Test 7 | { 8 | public class TestLogger : ClientDependency.Core.Logging.ILogger 9 | { 10 | public TestLogger() 11 | { 12 | Log.Logger = new LoggerConfiguration() 13 | .MinimumLevel.Debug() 14 | .WriteTo.File(HostingEnvironment.MapPath("~/App_Data/logs/cdfsite.txt"), rollingInterval: RollingInterval.Day) 15 | .CreateLogger(); 16 | 17 | Log.Information("App started"); 18 | } 19 | 20 | public void Debug(string msg) 21 | { 22 | Log.Logger.Debug(msg); 23 | } 24 | 25 | public void Info(string msg) 26 | { 27 | Log.Logger.Information(msg); 28 | } 29 | 30 | public void Warn(string msg) 31 | { 32 | Log.Logger.Warning(msg); 33 | } 34 | 35 | public void Error(string msg, Exception ex) 36 | { 37 | Log.Logger.Error(ex, msg); 38 | } 39 | 40 | public void Fatal(string msg, Exception ex) 41 | { 42 | Log.Logger.Fatal(ex, msg); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Shared/CustomControl.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> 2 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 3 | 4 | <% Html.RequiresCss("~/Css/CustomControl.css"); %> 5 | 6 |
7 |
My Custom Control
8 |
-------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Shared/Footer.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> 2 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 3 | 4 | <% Html.RequiresJs("~/Js/jquery-1.3.2.min.js", 1); %> 5 | <% Html.RequiresJs("FooterScript.js", "Scripts", 200); %> 6 | 7 | <%--Demonstrates the use of using the PathNameAlias--%> 8 | <% Html.RequiresCss("Controls.css", "Styles"); %> 9 | 10 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Shared/Header.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> 2 | <%@ Import Namespace="System.IO" %> 3 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 4 | 5 | <% Html.RequiresJs("~/Js/jquery-1.3.2.min.js", 1); %> 6 | 7 | <%--Demonstrates the use of using the PathNameAlias--%> 8 | <% Html.RequiresCss("Controls.css", "Styles"); %> 9 | 10 | 13 |
14 | This is a header 15 |
    16 | <%foreach(var f in Directory.GetFiles(Server.MapPath("~/Views/Test")).Where(x => x.EndsWith(".cshtml") || x.EndsWith(".aspx"))) { %> 17 |
  • <%= Html.ActionLink(Path.GetFileNameWithoutExtension(f), Path.GetFileNameWithoutExtension(f), null, new { @class = "white" }) %>
  • 18 | <%} %> 19 |
20 |
-------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Shared/Master.cshtml: -------------------------------------------------------------------------------- 1 | @model dynamic 2 | @using ClientDependency.Core.Mvc 3 | @using ClientDependency.Core 4 | 5 | 6 | 7 | 8 | 9 | @RenderSection("TitleContent") 10 | 11 | @RenderSection("HeadContent", false) 12 | @Html.RenderCssHere(new BasicPath("Styles", "~/Css")) 13 | 14 | 15 | 16 | 17 | @Html.RenderJsHere(new BasicPath("Scripts", "~/Js")) 18 | 19 | @{ 20 | Html.RequiresCss("ColorScheme.css", "Styles"); 21 | Html.RequiresCss("Site.css", "Styles"); 22 | } 23 | 24 | @Html.Partial("Header") 25 |
26 | @Html.Partial("SideBar") 27 | @RenderBody() 28 |
29 | @Html.Partial("Footer") 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Shared/SideBar.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> 2 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 3 | 4 | <% Html.RequiresJs("~/Js/jquery-1.3.2.min.js"); %> 5 | 6 | <%--Demonstrates the use of using the PathNameAlias--%> 7 | <% Html.RequiresCss("Controls.css", "Styles"); %> 8 | 9 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Shared/Site.Master: -------------------------------------------------------------------------------- 1 | <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> 2 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 3 | <%@ Import Namespace="ClientDependency.Core" %> 4 | 5 | 6 | 7 | 8 | <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> 9 | <%= Html.RenderCssHere(new BasicPath("Styles", "~/Css")) %> 10 | 11 | 12 | 13 | 14 | <%= Html.RenderJsHere(new BasicPath("Scripts", "~/Js")) %> 15 | 16 | <% Html.RequiresCss("ColorScheme.css", "Styles"); %> 17 | <% Html.RequiresCss("Site.css", "Styles"); %> 18 | 19 | <% Html.RenderPartial("Header"); %> 20 |
21 | <% Html.RenderPartial("SideBar"); %> 22 | 23 |
24 | <% Html.RenderPartial("Footer"); %> 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/Bundles.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ Html.RequiresCss("Content.css", "Styles") 14 | .RequiresCssBundle("CssBundle"); } 15 | 16 |
17 |

18 | This tests pre-defined bundles

19 |
20 |

We've defined a pre-defined css bundle in the global.asax called CssBundle and we have put a dependency on that bundle in this view

21 |
22 |
23 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/Coffee.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ Html.RequiresCss("Content.css", "Styles").RequiresJs("MyFirstCoffee.coffee", "Scripts");} 14 | 15 |
16 |

This tests CoffeeScript

17 |
18 | This page will compile a coffee script on the fly, it shows an alert which is the result of this coffee script: 19 |
20 |             # CoffeeScript
21 |             square = (x) -> x * x
22 |             cube   = (x) -> square(x) * x
23 |             alert(square 2 * cube 2);
24 |         
25 |
26 |
27 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/Default.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ 14 | 15 | Html.RequiresCss("Content.css", "Styles"); 16 | 17 | } 18 | 19 |
20 |

Using the default provider specified in the web.config

21 |
22 |

23 | Nothing fancy here, just rendering the script and style blocks using the default renderer. 24 | This library ships with the StandardRenderer set to the default renderer. 25 | The default renderer will render out standard script/style html blocks wherever you specify using 26 | the HtmlHelper: 27 |

28 |

29 | <%= Html.RenderCssHere(new BasicPath(""Styles"", ""/Css"")) %> 30 |

31 |

32 | To make a page/view/etc... dependent on a script or file just use this HtmlHelper methods: 33 |

34 |

35 | <% Html.RequiresCss(""Site.css"", ""Styles""); %>
36 | <% Html.RequiresJs(""/Js/jquery-1.3.2.min.js""); %> 37 |

38 |
39 |
40 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/DynamicPathRegistration.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2 | 3 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 4 | 5 | 6 | Dynamic Path Registration 7 | 8 | 9 | 10 | 11 | <% Html.RegisterPathAlias("NewCssPath", "~/Css/TestPath"); %> 12 | 13 | <% Html.RequiresCss("Content.css", "Styles"); %> 14 | <% Html.RequiresCss("BodyGradient.css", "NewCssPath"); %> 15 | <% Html.RequiresJs("HeaderOrange.js", "NewJsPath"); %> 16 | 17 | 18 |
19 |

Dynamic path registration

20 |
21 |

22 | In the MVC Action for this page, we've dynamically added a path registration and have dynamically added a 2nd one in the view. 23 |

24 |

25 | There are a few extension methods to acheive this, the direct way is to get an instance of the DependencyRenderer by calling the extension method 26 | GetLoader() on either the ControllerContext, ViewContext or HttpContextBase, then you can just use the AddPath methods. 27 |
28 | Otherwise, if you are working in a view, you can use the HtmlHelper methods: RegisterPathAlias 29 |

30 |
31 |
32 | 33 |
34 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/Folder.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ Html.RequiresJsFolder("~/Js/TestPath"); } 14 | 15 |
16 |

17 | This tests including an entire folder

18 | 19 |
20 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/ForcedProvider.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core 3 | @using ClientDependency.Core.Mvc 4 | 5 | @{ 6 | Layout = "~/Views/Shared/Master.cshtml"; 7 | } 8 | 9 | @section HeadContent 10 | { 11 | 12 | } 13 | @section TitleContent 14 | { 15 | Home Page 16 | } 17 | 18 | @{ Html.RequiresCss("Content.css", "Styles") 19 | .RequiresJs(new JavascriptFile("~/Js/SomeLazyLoadScript.js") {ForceProvider = "LazyLoadRenderer"}) 20 | .RequiresCss(new CssFile("Test.css") { PathNameAlias = "Styles", ForceProvider = "LazyLoadRenderer" }); } 21 | 22 |
23 |

24 | This tests forcing providers

25 |
26 |

On this page all JS will be rendered normally except for one which we've forced to use the lazy load provider

27 |

28 | 29 |

30 |
31 |
32 | 33 | @Html.RenderJsHere("LazyLoadRenderer") 34 | @Html.RenderCssHere("LazyLoadRenderer") -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/FromAspx.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ Html.RequiresCss("Content.css", "Styles").RequiresJs("~/Js/JsFromAspx.aspx");} 14 | 15 |
16 |

This tests results from an aspx page

17 |
18 | In some strange cases people return JavaScript or CSS from an ASPX page, this tests that it works. 19 |
20 |
21 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/Groups.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ 14 | Html.RequiresCss("Content.css", "Styles") 15 | .RequiresJs("jquery-1.3.2.min.js", "Scripts", 1, 1) 16 | .RequiresJs("jquery-ui-1.8.13.custom.min.js", "Scripts", 2, 1) 17 | .RequiresJs("AnotherTest.js?v=1234", "Scripts", 1, 2); 18 | } 19 | 20 |
21 |

Dependency groups

22 |
23 |

24 | On this page, we've got the jquery libraries grouped so that they are shared across pages, other dependencies are loaded normally. 25 |

26 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/HtmlAttributes.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2 | 3 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 4 | 5 | 6 | Custom Html Attributes Test 7 | 8 | 9 | 10 | 11 | <%--Load the jquery ui from cdn and make sure it isn't replaced--%> 12 | <% Html.RequiresJs("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js", 3); %> 13 | <% Html.RequiresJs("JQueryTemplate.js", "Scripts", new { type = "text/html" }); %> 14 | 15 | <% Html.RequiresCss("Content.css", "Styles"); %> 16 | <% Html.RequiresCss("Print.css", "Styles", new { media = "print" }); %> 17 | 18 |
19 |

Some dependencies are have custom html attributes

20 |
21 |

22 | On this page we have 2 dependencies registered with custom html attributes: 23 |

24 |
    25 |
  • A print style sheet with a custom media='print' attribute
  • 26 |
  • A js dependency with a type='text/html' which could be used as a jquery template
  • 27 |
28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/ImportsCss.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ Html.RequiresCss("Imports.css", "Styles"); } 14 | 15 |
16 |

17 | This tests @@import statement in css

18 |
19 |

The Imports.css file is used here which also imports the Content.css and the OverrideStyles.css

20 |
21 |
22 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/Less.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ Html.RequiresCss("Content.css", "Styles").RequiresCss("MyFirstLess.less", "Styles");} 14 | 15 |
16 |

17 | This tests DotLess

18 |
19 |
This is the color #CC0000 which is the result of styling with a dotless stylesheet
20 |
21 |
22 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/RemoteDependencies.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> 2 | 3 | <%@ Import Namespace="ClientDependency.Core.Mvc" %> 4 | 5 | 6 | Rogue Dependency Test 7 | 8 | 9 | 10 | 11 | <%--Load the jquery ui from cdn and make sure it isn't replaced--%> 12 | <% Html.RequiresJs("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js", 3); %> 13 | 14 | <% Html.RequiresCss("Content.css", "Styles"); %> 15 | 16 |
17 |

Some dependencies are from remote servers

18 |
19 |

20 | On this page, we've got the jquery library loaded from our local server with a priority of '1', but we've got the jquery UI registered with a file path from the Google CDN with a priority of '3' 21 |

22 |

23 | In the source of this page, ClientDependency has split the registrations for JavaScript so that everthing found before the jQuery UI lib is compressed, combined, etc.. then the jQuery UI lib is registered for downloading from the CDN, then everything after is again compressed, combined, etc... 24 |

25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/Views/Test/TypeScript.cshtml: -------------------------------------------------------------------------------- 1 | @model ClientDependency.Web.Test.Models.TestModel 2 | @using ClientDependency.Core.Mvc 3 | 4 | @{ 5 | Layout = "~/Views/Shared/Master.cshtml"; 6 | } 7 | 8 | @section TitleContent 9 | { 10 | Home Page 11 | } 12 | 13 | @{ Html.RequiresCss("Content.css", "Styles").RequiresJs("MyFirstTypeScript.ts", "Scripts");} 14 | 15 |
16 |

This tests TypeScript

17 |
18 | This page will compile a TypeScript on the fly, it shows an alert which is the result of this TypeScript: 19 |
20 |             function greeter(person: string) {
21 |                 return "Hello, " += person;
22 |             }
23 |             var user = "Jane User";
24 |             alert(user);
25 |         
26 |
27 |
28 | -------------------------------------------------------------------------------- /src/ClientDependency.Web.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/DLLs/umbraco.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shazwazza/ClientDependency/b7e3ea36837b469eb7d05d67a8e1a43e80c3b1d7/src/DLLs/umbraco.dll -------------------------------------------------------------------------------- /src/SolutionInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Security; 3 | 4 | [assembly: AssemblyCompany("Shannon Deminick")] 5 | [assembly: AssemblyCopyright("Copyright © Shannon Deminick 2021")] 6 | [assembly: AssemblyTrademark("")] 7 | [assembly: AssemblyCulture("")] 8 | 9 | 10 | [assembly: AssemblyVersion("1.9.10")] 11 | [assembly: AssemblyFileVersion("1.9.10")] 12 | [assembly: AssemblyInformationalVersion("1.9.10")] 13 | -------------------------------------------------------------------------------- /src/Umbraco4.ClientDependency/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Umbraco4.ClientDependency")] 9 | [assembly: AssemblyDescription("Umbraco assembly for updated Canvas provider")] 10 | 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("059645d3-8c7f-4610-a4d8-7811a0133d00")] 18 | --------------------------------------------------------------------------------