├── .gitattributes ├── .gitignore ├── InlineCssParser.sln ├── InlineCssParser ├── Command.cs ├── CommandPackage.cs ├── CommandPackage.vsct ├── HtmlElement.cs ├── InlineCssParser.csproj ├── Key.snk ├── Parser.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Command.png │ ├── CommandPackage.ico │ ├── logo.ico │ ├── logo.png │ └── menu.png ├── SampleHtmls │ ├── Default.aspx │ ├── advance_sample.html │ ├── sample.cshtml │ └── sample.html ├── VSPackage.resx ├── app.config ├── packages.config ├── screenshots │ ├── 1.jpg │ ├── 2.jpg │ └── 3.jpg └── source.extension.vsixmanifest └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | -------------------------------------------------------------------------------- /InlineCssParser.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InlineCssParser", "InlineCssParser\InlineCssParser.csproj", "{78FFA5A2-A4C2-4DA6-B2AC-C859C8979B61}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {78FFA5A2-A4C2-4DA6-B2AC-C859C8979B61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {78FFA5A2-A4C2-4DA6-B2AC-C859C8979B61}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {78FFA5A2-A4C2-4DA6-B2AC-C859C8979B61}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {78FFA5A2-A4C2-4DA6-B2AC-C859C8979B61}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {A1DFBC55-0DC5-4194-8B1D-C8F5770329BF} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /InlineCssParser/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Design; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | using EnvDTE; 6 | using System.Linq; 7 | using System.Collections.Generic; 8 | 9 | namespace InlineCssParser 10 | { 11 | /// 12 | /// Command handler 13 | /// 14 | internal sealed class Command 15 | { 16 | /// 17 | /// Command ID. 18 | /// 19 | public const int CommandId = 0x0100; 20 | private Parser _parser; 21 | private IVsStatusbar bar; 22 | 23 | private IVsStatusbar StatusBar 24 | { 25 | get 26 | { 27 | if (bar == null) 28 | { 29 | bar = this.ServiceProvider.GetService(typeof(SVsStatusbar)) as IVsStatusbar; 30 | } 31 | 32 | return bar; 33 | } 34 | } 35 | 36 | /// 37 | /// Command menu group (command set GUID). 38 | /// 39 | public static readonly Guid CommandSet = new Guid("82b0ea61-76c4-4c2c-bbf1-03ec5f8523c3"); 40 | 41 | /// 42 | /// VS Package that provides this command, not null. 43 | /// 44 | private readonly Package _package; 45 | 46 | /// 47 | /// Initializes a new instance of the class. 48 | /// Adds our command handlers for menu (commands must exist in the command table file) 49 | /// 50 | /// Owner package, not null. 51 | private Command(Package package, OleMenuCommandService commandService) 52 | { 53 | ThreadHelper.ThrowIfNotOnUIThread(); 54 | 55 | _package = package ?? throw new ArgumentNullException(nameof(package)); 56 | 57 | _parser = new Parser(); 58 | 59 | var menuCommandID = new CommandID(CommandSet, CommandId); 60 | var menuItem = new MenuCommand(this.MenuItemCallback, menuCommandID); 61 | commandService.AddCommand(menuItem); 62 | } 63 | 64 | /// 65 | /// Gets the instance of the command. 66 | /// 67 | public static Command Instance 68 | { 69 | get; 70 | private set; 71 | } 72 | 73 | /// 74 | /// Gets the service provider from the owner package. 75 | /// 76 | private IServiceProvider ServiceProvider 77 | { 78 | get 79 | { 80 | return _package; 81 | } 82 | } 83 | 84 | /// 85 | /// Initializes the singleton instance of the command. 86 | /// 87 | /// Owner package, not null. 88 | public static void Initialize(Package package, OleMenuCommandService commandService) 89 | { 90 | Instance = new Command(package, commandService); 91 | } 92 | 93 | /// 94 | /// This function is the callback used to execute the command when the menu item is clicked. 95 | /// See the constructor to see how the menu item is associated with this function using 96 | /// OleMenuCommandService service and MenuCommand class. 97 | /// 98 | /// Event sender. 99 | /// Event args. 100 | private void MenuItemCallback(object sender, EventArgs e) 101 | { 102 | ThreadHelper.ThrowIfNotOnUIThread(); 103 | 104 | DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE; 105 | Document doc = dte.ActiveDocument; 106 | TextDocument txtDoc = doc.Object() as TextDocument; 107 | 108 | var text = txtDoc.CreateEditPoint(txtDoc.StartPoint).GetText(txtDoc.EndPoint); 109 | text = text.Replace("\r", ""); 110 | 111 | uint cookie = 0; 112 | StatusBar.Progress(ref cookie, 1, string.Empty, 0, 0); 113 | 114 | if (txtDoc.Language == "HTMLX" || txtDoc.Language == "HTML") 115 | { 116 | var html = text; 117 | var elementList = new List(); 118 | var parsed = _parser.ParseHtml(html, elementList, txtDoc, StatusBar, ref cookie); 119 | var cssFileContent = string.Empty; 120 | 121 | if (elementList.Any()) 122 | { 123 | foreach (var item in elementList) 124 | { 125 | var cssClass = string.Empty; 126 | if (string.IsNullOrEmpty(item.Class)) 127 | { 128 | cssClass = string.Format(".{0}", string.IsNullOrEmpty(item.Id) ? CreateUniqueElementKey(item.Name, item.LineNumber) : item.Id); 129 | } 130 | else 131 | { 132 | cssClass = string.Format(".{0} .{1}", item.Class, CreateUniqueElementKey(item.Name, item.LineNumber)); 133 | } 134 | 135 | var idAttr = string.IsNullOrEmpty(item.Id) ? string.Empty : string.Format("id=\"{0}\"", item.Id); 136 | var replaceText = string.Format("{0} {1} class=\"{2}\"", item.Name, idAttr, cssClass.Replace(".", string.Empty)); 137 | 138 | parsed = parsed.Replace(item.Guid, replaceText); 139 | cssFileContent += string.Format("{0}{{{1}}}\n\n", cssClass, "\n" + item.Style); 140 | } 141 | 142 | //css file beautification 143 | cssFileContent = cssFileContent.Replace(";", ";\n"); 144 | 145 | //update html file 146 | var txtSelHtml = (TextSelection)doc.Selection; 147 | txtSelHtml.SelectAll(); 148 | txtSelHtml.Delete(); 149 | txtSelHtml.Insert(parsed); 150 | 151 | //create css file 152 | var docName = doc.Name.Substring(0, doc.Name.IndexOf('.')); 153 | docName = string.Format("{0}.css", docName); 154 | 155 | dte.ItemOperations.NewFile(@"General\Text File", docName, EnvDTE.Constants.vsViewKindTextView); 156 | 157 | var txtSelCss = (TextSelection)dte.ActiveDocument.Selection; 158 | txtSelCss.SelectAll(); 159 | txtSelCss.Delete(); 160 | txtSelCss.Insert(cssFileContent); 161 | } 162 | else 163 | { 164 | VsShellUtilities.ShowMessageBox(this.ServiceProvider, "Not found inline css.", "That's Cool!", 165 | OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 166 | } 167 | } 168 | else 169 | { 170 | VsShellUtilities.ShowMessageBox(this.ServiceProvider, "This is not a html file!", "Oops!", 171 | OLEMSGICON.OLEMSGICON_WARNING, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); 172 | } 173 | 174 | // Clear the progress bar. 175 | StatusBar.Progress(ref cookie, 0, string.Empty, 0, 0); 176 | StatusBar.FreezeOutput(0); 177 | StatusBar.Clear(); 178 | } 179 | 180 | private string CreateUniqueElementKey(string name, int lineNumber) 181 | { 182 | return string.Format("{0}_line_{1}", name, lineNumber); 183 | } 184 | } 185 | } -------------------------------------------------------------------------------- /InlineCssParser/CommandPackage.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Company. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | using System; 8 | using System.ComponentModel.Design; 9 | using System.Diagnostics.CodeAnalysis; 10 | using System.Runtime.InteropServices; 11 | using System.Threading; 12 | using Microsoft.VisualStudio.Shell; 13 | using Task = System.Threading.Tasks.Task; 14 | 15 | namespace InlineCssParser 16 | { 17 | /// 18 | /// This is the class that implements the package exposed by this assembly. 19 | /// 20 | /// 21 | /// 22 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 23 | /// is to implement the IVsPackage interface and register itself with the shell. 24 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 25 | /// to do it: it derives from the Package class that provides the implementation of the 26 | /// IVsPackage interface and uses the registration attributes defined in the framework to 27 | /// register itself and its components with the shell. These attributes tell the pkgdef creation 28 | /// utility what data to put into .pkgdef file. 29 | /// 30 | /// 31 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. 32 | /// 33 | /// 34 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 35 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] // Info on this package for Help/About 36 | [ProvideMenuResource("Menus.ctmenu", 1)] 37 | [Guid(PackageGuidString)] 38 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 39 | public sealed class CommandPackage : AsyncPackage 40 | { 41 | /// 42 | /// CommandPackage GUID string. 43 | /// 44 | public const string PackageGuidString = "80ff1353-14f0-4cd4-a639-13d6aa0a098c"; 45 | 46 | #region Package Members 47 | 48 | /// 49 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 50 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 51 | /// 52 | /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. 53 | /// A provider for progress updates. 54 | /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. 55 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 56 | { 57 | if (await GetServiceAsync(typeof(IMenuCommandService)) is OleMenuCommandService commandService) 58 | { 59 | Command.Initialize(this, commandService); 60 | } 61 | } 62 | 63 | #endregion 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /InlineCssParser/CommandPackage.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /InlineCssParser/HtmlElement.cs: -------------------------------------------------------------------------------- 1 | namespace InlineCssParser 2 | { 3 | public class HtmlElement 4 | { 5 | public string Id { get; set; } 6 | public string Name { get; set; } 7 | public string Style { get; set; } 8 | public string Guid { get; set; } 9 | public string Class { get; set; } 10 | public int LineNumber { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /InlineCssParser/InlineCssParser.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 15.0 7 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 8 | 9 | 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 14.0 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | true 35 | 36 | 37 | Key.snk 38 | 39 | 40 | Resources\logo.ico 41 | 42 | 43 | 44 | Debug 45 | AnyCPU 46 | 2.0 47 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 48 | {78FFA5A2-A4C2-4DA6-B2AC-C859C8979B61} 49 | Library 50 | Properties 51 | InlineCssParser 52 | InlineCssParser 53 | v4.7.2 54 | true 55 | true 56 | true 57 | true 58 | true 59 | false 60 | 61 | 62 | true 63 | full 64 | false 65 | bin\Debug\ 66 | DEBUG;TRACE 67 | prompt 68 | 4 69 | false 70 | False 71 | 72 | 73 | pdbonly 74 | true 75 | bin\Release\ 76 | TRACE 77 | prompt 78 | 4 79 | false 80 | False 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | ASPXCodeBehind 92 | 93 | 94 | 95 | Designer 96 | 97 | 98 | 99 | Designer 100 | 101 | 102 | Always 103 | true 104 | 105 | 106 | 107 | Always 108 | true 109 | 110 | 111 | 112 | Designer 113 | 114 | 115 | 116 | 117 | Menus.ctmenu 118 | Designer 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | False 127 | 128 | 129 | ..\packages\MessagePack.2.1.90\lib\netstandard2.0\MessagePack.dll 130 | 131 | 132 | ..\packages\MessagePack.Annotations.2.1.90\lib\netstandard2.0\MessagePack.Annotations.dll 133 | 134 | 135 | ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll 136 | 137 | 138 | 139 | 140 | False 141 | 142 | 143 | ..\packages\Microsoft.VisualStudio.CoreUtility.16.4.280\lib\net472\Microsoft.VisualStudio.CoreUtility.dll 144 | 145 | 146 | ..\packages\Microsoft.VisualStudio.ImageCatalog.16.4.29519.181\lib\net45\Microsoft.VisualStudio.ImageCatalog.dll 147 | 148 | 149 | ..\packages\Microsoft.VisualStudio.Imaging.16.4.29519.181\lib\net472\Microsoft.VisualStudio.Imaging.dll 150 | 151 | 152 | ..\packages\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.14.3.26930\lib\net20\Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll 153 | True 154 | 155 | 156 | ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6071\lib\Microsoft.VisualStudio.OLE.Interop.dll 157 | 158 | 159 | ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll 160 | True 161 | 162 | 163 | ..\packages\Microsoft.VisualStudio.Shell.Framework.16.4.29519.181\lib\net472\Microsoft.VisualStudio.Shell.Framework.dll 164 | 165 | 166 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.15.0.25415\lib\net45\Microsoft.VisualStudio.Shell.Immutable.10.0.dll 167 | 168 | 169 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.15.0.25415\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll 170 | 171 | 172 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.15.0.25415\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll 173 | 174 | 175 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.15.0.25405\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll 176 | 177 | 178 | ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6072\lib\net11\Microsoft.VisualStudio.Shell.Interop.dll 179 | 180 | 181 | ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30320\lib\net20\Microsoft.VisualStudio.Shell.Interop.10.0.dll 182 | True 183 | 184 | 185 | ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61031\lib\net20\Microsoft.VisualStudio.Shell.Interop.11.0.dll 186 | True 187 | 188 | 189 | ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30111\lib\net20\Microsoft.VisualStudio.Shell.Interop.12.0.dll 190 | True 191 | 192 | 193 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.Shell.Interop.8.0.dll 194 | 195 | 196 | ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30730\lib\net11\Microsoft.VisualStudio.Shell.Interop.9.0.dll 197 | 198 | 199 | ..\packages\Microsoft.VisualStudio.Text.Data.16.4.280\lib\net472\Microsoft.VisualStudio.Text.Data.dll 200 | 201 | 202 | ..\packages\Microsoft.VisualStudio.Text.Logic.16.4.280\lib\net472\Microsoft.VisualStudio.Text.Logic.dll 203 | 204 | 205 | ..\packages\Microsoft.VisualStudio.Text.UI.16.4.280\lib\net472\Microsoft.VisualStudio.Text.UI.dll 206 | 207 | 208 | ..\packages\Microsoft.VisualStudio.Text.UI.Wpf.16.4.280\lib\net472\Microsoft.VisualStudio.Text.UI.Wpf.dll 209 | 210 | 211 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6071\lib\net11\Microsoft.VisualStudio.TextManager.Interop.dll 212 | 213 | 214 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50728\lib\net11\Microsoft.VisualStudio.TextManager.Interop.8.0.dll 215 | 216 | 217 | ..\packages\Microsoft.VisualStudio.Threading.16.5.132\lib\net472\Microsoft.VisualStudio.Threading.dll 218 | 219 | 220 | ..\packages\Microsoft.VisualStudio.Utilities.16.4.29519.181\lib\net46\Microsoft.VisualStudio.Utilities.dll 221 | 222 | 223 | ..\packages\Microsoft.VisualStudio.Validation.15.5.31\lib\netstandard2.0\Microsoft.VisualStudio.Validation.dll 224 | 225 | 226 | ..\packages\Microsoft.Win32.Registry.4.7.0\lib\net461\Microsoft.Win32.Registry.dll 227 | 228 | 229 | ..\packages\Nerdbank.Streams.2.4.60\lib\netstandard2.0\Nerdbank.Streams.dll 230 | 231 | 232 | ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll 233 | 234 | 235 | 236 | 237 | False 238 | 239 | 240 | ..\packages\StreamJsonRpc.2.3.103\lib\netstandard2.0\StreamJsonRpc.dll 241 | 242 | 243 | 244 | ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll 245 | 246 | 247 | ..\packages\System.Collections.Immutable.1.7.0\lib\netstandard2.0\System.Collections.Immutable.dll 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll 256 | True 257 | True 258 | 259 | 260 | ..\packages\System.IO.Pipelines.4.7.0\lib\netstandard2.0\System.IO.Pipelines.dll 261 | 262 | 263 | ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll 264 | 265 | 266 | ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll 267 | True 268 | True 269 | 270 | 271 | ..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll 272 | True 273 | True 274 | 275 | 276 | 277 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll 278 | 279 | 280 | ..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll 281 | True 282 | True 283 | 284 | 285 | ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll 286 | 287 | 288 | ..\packages\System.Security.AccessControl.4.7.0\lib\net461\System.Security.AccessControl.dll 289 | 290 | 291 | ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll 292 | True 293 | True 294 | 295 | 296 | ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll 297 | True 298 | True 299 | 300 | 301 | ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll 302 | True 303 | True 304 | 305 | 306 | ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll 307 | True 308 | True 309 | 310 | 311 | ..\packages\System.Security.Principal.Windows.4.7.0\lib\net461\System.Security.Principal.Windows.dll 312 | 313 | 314 | ..\packages\System.Threading.Tasks.Dataflow.4.11.0\lib\netstandard2.0\System.Threading.Tasks.Dataflow.dll 315 | 316 | 317 | ..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll 318 | 319 | 320 | ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | true 331 | VSPackage 332 | Designer 333 | 334 | 335 | 336 | 337 | False 338 | .NET Framework 3.5 SP1 339 | false 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 374 | -------------------------------------------------------------------------------- /InlineCssParser/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/Key.snk -------------------------------------------------------------------------------- /InlineCssParser/Parser.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using Microsoft.VisualStudio.Shell; 3 | using Microsoft.VisualStudio.Shell.Interop; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | 8 | namespace InlineCssParser 9 | { 10 | public class Parser 11 | { 12 | public string ParseHtml(string text, List elementList, TextDocument txtDoc, IVsStatusbar bar, ref uint cookie) 13 | { 14 | ThreadHelper.ThrowIfNotOnUIThread(); 15 | 16 | int pointer = 0; 17 | var startTagIndex = 0; 18 | var endTagIndex = 0; 19 | var endTagBefore = 0; 20 | uint completed = 0; 21 | uint total = (uint)text.Count(q => q == '<'); 22 | 23 | #region trimming style tags contens 24 | 25 | while (text.Contains("; ") || text.Contains(": ")) //to fix style tag content 26 | { 27 | text = text.Replace("; ", ";").Replace(": ", ":"); 28 | } 29 | 30 | #endregion 31 | 32 | text = text.Replace("STYLE", "style"); 33 | startTagIndex = text.IndexOf('<', pointer); 34 | endTagIndex = text.IndexOf('>', pointer); 35 | 36 | try 37 | { 38 | txtDoc.Selection.StartOfDocument(); 39 | while (pointer < text.Length && startTagIndex != -1 || endTagIndex != -1) 40 | { 41 | completed++; 42 | bar.Progress(ref cookie, 1, string.Empty, completed, total); 43 | bar.SetText("Extracting inline styles ..."); 44 | 45 | #region to find current line (txtDoc.Selection.CurrentLine) 46 | 47 | txtDoc.Selection.CharRight(false, endTagIndex - endTagBefore); 48 | endTagBefore = endTagIndex; 49 | 50 | #endregion 51 | 52 | var elementText = text.Substring(startTagIndex + 1, (endTagIndex - (startTagIndex + 1))); 53 | if (elementText.Contains("style=")) // '=' is necessary 54 | { 55 | var parsedElement = elementText.Split(' '); 56 | var elementName = parsedElement[0]; 57 | var elementId = string.Empty; 58 | var elementStyle = string.Empty; 59 | var elementClass = string.Empty; 60 | 61 | #region checking id attr 62 | 63 | var idAttr = parsedElement.FirstOrDefault(q => q.Contains("id=")); 64 | if (idAttr != null) 65 | { 66 | elementId = idAttr.Replace("id=", string.Empty).Replace("\"", string.Empty); 67 | } 68 | 69 | #endregion 70 | 71 | #region checking style attr 72 | 73 | if (parsedElement.Any(q => q.Contains("style="))) 74 | { 75 | var styleStart = elementText.IndexOf("\"", elementText.IndexOf("style=")) + 1; 76 | var styleEnd = elementText.IndexOf("\"", styleStart); 77 | elementStyle = elementText.Substring(styleStart, (styleEnd - styleStart)); 78 | } 79 | 80 | elementStyle = elementStyle.EndsWith(";") ? elementStyle : string.Format("{0};", elementStyle); 81 | 82 | #endregion 83 | 84 | #region checking class attr 85 | 86 | var classAttr = parsedElement.Any(q => q.Contains("class=")); 87 | if (classAttr) 88 | { 89 | //one class or more? 90 | var classStart = elementText.IndexOf("\"", elementText.IndexOf("class")); 91 | var classEnd = elementText.IndexOf("\"", classStart + 1); 92 | var classText = elementText.Substring(classStart, (classEnd - classStart)); 93 | classText = classText.Replace(" ", " ."); // "class1 class2" - > "class1 .class2" 94 | elementClass = classText.Replace("\"", string.Empty); 95 | } 96 | 97 | #endregion 98 | 99 | var guid = Guid.NewGuid().ToString(); 100 | 101 | text = text.Replace(elementText, guid); 102 | 103 | pointer = text.IndexOf('>', text.IndexOf(guid)) + 1; 104 | 105 | endTagBefore += (guid.Length - elementText.Length); 106 | 107 | elementList.Add(new HtmlElement 108 | { 109 | Id = elementId, 110 | Name = elementName, 111 | Style = elementStyle, 112 | Class = elementClass, 113 | Guid = guid, 114 | LineNumber = txtDoc.Selection.CurrentLine 115 | }); 116 | } 117 | else 118 | { 119 | pointer = endTagIndex + 1; 120 | } 121 | 122 | startTagIndex = text.IndexOf('<', pointer); 123 | endTagIndex = text.IndexOf('>', pointer); 124 | } 125 | } 126 | catch (Exception) 127 | { 128 | // Clear the progress bar. 129 | bar.Progress(ref cookie, 0, string.Empty, 0, 0); 130 | bar.FreezeOutput(0); 131 | bar.Clear(); 132 | } 133 | 134 | return text; 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /InlineCssParser/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("InlineCssParser")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("InlineCssParser")] 13 | [assembly: AssemblyCopyright("")] 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 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /InlineCssParser/Resources/Command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/Resources/Command.png -------------------------------------------------------------------------------- /InlineCssParser/Resources/CommandPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/Resources/CommandPackage.ico -------------------------------------------------------------------------------- /InlineCssParser/Resources/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/Resources/logo.ico -------------------------------------------------------------------------------- /InlineCssParser/Resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/Resources/logo.png -------------------------------------------------------------------------------- /InlineCssParser/Resources/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/Resources/menu.png -------------------------------------------------------------------------------- /InlineCssParser/SampleHtmls/Default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebFormSample._Default" %> 2 | 3 | 4 |
5 |
6 |
7 |

<%: Title %>.

8 |

Modify this template to jump-start your ASP.NET application.

9 |
10 |

11 | To learn more about ASP.NET, visit http://asp.net. 12 | The page features videos, tutorials, and samples to help you get the most from ASP.NET. 13 | If you have any questions about ASP.NET visit 14 | our forums. 15 |

16 |
17 |
18 |
19 | 20 |

We suggest the following:

21 |
    22 |
  1. 23 |
    Getting Started
    24 | ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model. 25 | A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access. 26 | Learn more… 27 |
  2. 28 |
  3. 29 |
    Add NuGet packages and jump-start your coding
    30 | NuGet makes it easy to install and update free libraries and tools. 31 | Learn more… 32 |
  4. 33 |
  5. 34 |
    Find Web Hosting
    35 | You can easily find a web hosting company that offers the right mix of features and price for your applications. 36 | Learn more… 37 |
  6. 38 |
39 |
40 | -------------------------------------------------------------------------------- /InlineCssParser/SampleHtmls/advance_sample.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | How to Use Inline, Embedded, and External CSS 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 |
html tutorialsweb design helpcss tutorialsfree web graphics 21 | 22 | diy search engine optimization
26 | 27 | 28 | 29 | 43 | 44 |
45 | 46 | 47 | 48 | 144 | 173 | 174 | 175 | 199 | 200 |
49 | 50 | 51 |

How to Use Inline, Embedded, and External CSS

52 | 53 | As explained in the previous two parts of this tutorial series, there are three ways to implement CSS in your web design. The how-to of it is explained below. Any and all methods can be used on a web page, but there are "best use" practices that, if you follow them, will prove to be the most efficient for you. These best uses are as follows: 54 | 55 |
56 |
Inline Styles
57 |
Inline styles are best used sparingly. Use them where you want to override a style coded into your external or embedded styles. Also use them when you want a quick change where the style isn't going to be needed often.
58 | 59 |
Embedded Styles
60 |
Embedded styles are best used where you will be using the styles repeatedly on one page, but those styles aren't needed for most of your site.
61 | 62 |
External Styles
63 |
External styles are best used to define styles that will be used repeatedly across many pages of your web site. This allows you to make a change to the external style sheet and have that change reflected on all the pages that draw their styles from it. 64 |
65 | 66 | Following those guidelines will help you make the most of using CSS. Here's how each of those styles are implemented: 67 | 68 |

Inline Styles

69 | 70 | Using inline CSS is very much like coding an attribute and value into an HTML tag. Here's an example of an inline style rule. 71 |
 72 | <pre style="color: red; margin-left: 17px;">
 73 | 
74 | The above style rule is the same style I used to show code examples, only I don't use it inline (so I don't have to repeat it each time I want to show a code example). It's a simple <pre> tag with a style rule added. To cancel that style rule, use the </pre> just as you know from standard HTML. 75 |

76 | Using inline CSS only affects the HTML element that it's coded into. If you wanted to repeat that style at another place on your page, you'd have to code that style into each use of the element, in this case, another <pre> tag. 77 |

78 | There are a multitude of different things you can do with CSS, it's just a matter of learning what the options are and how to code them. I have 31 different HTML and CSS reference charts in my members area and demonstrate dozens of different CSS uses there. It's the one place where it's all put together for you in plain English. 79 |

80 | 81 |

Embedded Styles

82 | 83 | Embedded styles are placed in the HEAD section of a web page, placed between style declaration opening and closing tags. Unlike inline style rules where you have to code a style into each HTML element, embedded rules affect every usage of an HTML element on the page where it's embedded. Here's a example: 84 |
 85 | <style type="text/css">
 86 | div {font-family: Arial; font-size: 14px; margin-left: 30px;}
 87 | p   {border-left: 1px dotted gray;}
 88 | </style>
 89 | 
90 | If the above style rules were placed in the HEAD section of a web page's source code, here's how it would affect the page display: 91 | 92 |
    93 |
  • Each time you used a division tag (<div>) on the page the text within that division would be shown in the Arial font at 14 pixels high. The division would also have a margin of 30 pixels on the left side. Using the margin-left property is how I indent code examples.
  • 94 |
  • Each time you used a paragraph tag (<p>) there would be a 1 pixel thick dotted gray line on the left side of the paragraph space.
  • 95 |
96 | 97 | You probably noticed that the formatting of style rules differs from HTML. Good job! Let's look a little closer at that. 98 |

99 | As you know, HTML elements are enclosed between the < and > brackets. Confusion would abound for webmasters and browser programmers alike if CSS also used arrow brackets. Therefore, the opening <style type="text/css"> and closing </style> tags identify the code in between as CSS code. 100 |

101 | The selector (the HTML element you wish to create a rule for) is listed without any brackets since it's already enclosed between the opening and closing style declaration. The selector is then followed by curly braces { ... } that enclose the property and value, which is the rule for the chosen selector. 102 |

103 | The property and value are separated by a colon and space. Example: 104 |

105 | color: red;
106 | 
107 | 108 | The semi-colon signals the end of a rule. Because each selector can have more than one rule, the semi-colon also serves as a rules separator. Example: 109 |
110 | color: red; background-color: black; font-size: 18px;
111 | 
112 | 113 | You should always include the semi-colon after a rule, even if you're only creating one rule. Truth is, a single rule will work most of the time if you forget the semi-colon, but results can be unpredictable in some instances. It's also a good habit. If you always include the semi-colon for single rules, there's less of a chance you'll leave one out where it's needed as a rules separator when you create multiple rules for one selector. 114 | 115 |

External Styles

116 | 117 | An external style sheet contains the style rules you create, saved in a plain text file, but with a .css file extension instead of a .txt file extension. To save a file with a .css extention, in most text editors you can simply place quotation marks around your file name as you save it. Example: 118 |
119 | "MyStyles.css"
120 | 
121 | The contents of your linked style sheet is the same as you would place in an embedded style, minus the opening <style type="text/css"> and closing </style> tags. These are not needed because the browser knows it's a style sheet from the link to the style sheet. 122 |

123 | To link to a style sheet, place the following line of code in the HEAD section of your page: 124 |

125 | <link rel="stylesheet" href="css/sitewide.css" type="text/css" />
126 | 
127 | There is no closing tag for this link. To make the code XHTML compliant, I closed the tag with a space and forward slash just before the right arrow bracket. You needn't do that if you don't care if your pages are XHTML compliant. 128 |

129 | Where I have css/sitewide.css, you'd change that to reflect the path to and name of your own style sheet. To see a real example of a simple external style sheet, try this one saved as a text file. You could save that file with a .css extension and link to it, and it would control the HTML elements that have rules created for them on all the pages you link to it from. 130 |

131 | 132 |

133 | This tutorial continues... 134 |

135 | 136 | 137 |
138 | Back | 139 | Web Design Tutorials Index 140 |
141 | 142 | 143 |
145 | 146 |
147 | 148 |

149 | 150 | Ezine for Webmasters 151 | 152 |

153 | 154 | 155 | 156 | Bookmark and Share 157 | 158 |

159 |
160 | 161 |

Almost a Newsletter

162 | 163 |
164 | 167 |
168 | 169 |

Did you know...

170 | The member's site has about 100 standards compliant HTML and CSS tutorials, 31 handy reference charts, reprintable content, web graphics, exclusive fonts, free software, free ebooks and more? All this for less than 9 cents a day! [ Details ] 171 | 172 |
201 | See my fancy bottom! :) 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /InlineCssParser/SampleHtmls/sample.cshtml: -------------------------------------------------------------------------------- 1 | @using Ninja.Core.Models 2 | @{ 3 | ViewBag.Title = "Pricing"; 4 | } 5 | 6 |

@ViewBag.Title

7 | 8 |
9 | 10 |
11 |

12 | Kullanılan Costlar 13 |

14 | 15 |
16 |
17 |
18 |
19 | 20 |
21 |

22 | Sonuçlar 23 |

24 |
25 |
26 | 27 |
28 |
29 |
30 | 31 | 32 | 33 | 36 | 40 | 41 | 42 | 45 | 49 | 50 |
34 | İndirim Oranı (%) 35 | 37 | 38 | 39 |
43 | İndirimli Fiyat (TL/kwh) 44 | 46 | 47 | 48 |
51 |
52 |
53 |
54 |
55 | 56 | 70 | -------------------------------------------------------------------------------- /InlineCssParser/SampleHtmls/sample.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | -------------------------------------------------------------------------------- /InlineCssParser/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 12 | 13 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | text/microsoft-resx 120 | 121 | 122 | 2.0 123 | 124 | 125 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 126 | 127 | 128 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 129 | 130 | 131 | 132 | Command Extension 133 | 134 | 135 | Command Visual Studio Extension Detailed Info 136 | 137 | 138 | Resources\CommandPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 139 | 140 | -------------------------------------------------------------------------------- /InlineCssParser/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /InlineCssParser/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /InlineCssParser/screenshots/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/screenshots/1.jpg -------------------------------------------------------------------------------- /InlineCssParser/screenshots/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/screenshots/2.jpg -------------------------------------------------------------------------------- /InlineCssParser/screenshots/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suadev/InlineCssParser/424a34f95789f379338f42594c143981a4bb1594/InlineCssParser/screenshots/3.jpg -------------------------------------------------------------------------------- /InlineCssParser/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Inline Style Parser for Html Files 6 | A Visual Studio Extension that helps to extract inline styles into a seperate css file. 7 | Resources\logo.png 8 | Resources\logo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Inline Style Parser for Html Files 2 | 3 |

A Visual Studio Extension that helps to extract inline styles into a separate css file. 

4 | 5 | Available on Visual Studio Marketplace 6 | 7 | https://marketplace.visualstudio.com/items?itemName=SuatKOSE.InlineStyleParserforHtmlFiles 8 | 9 | Supporting .html, .aspx and .cshtml file formats. 10 | 11 | Just right click on a html file source code and extract all inline styles into a separate css file. See the attached screenshots below. 12 | 13 | Please let me know if you realize that something is wrong. 14 | 15 | Thank you. 16 | 17 |

1-Sample Html

18 |

19 |

20 |

 

21 |

2-After Extracting Inline Styles

22 |

23 |


24 |

25 |

 3-Created .css File

26 |


27 |

28 | 29 | --------------------------------------------------------------------------------