Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TagHelper to support script type #10

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# Roadmap

- [ ] ASP.NET Core TagHelper support
- [ ] Create additional source map for the bundle files
- [ ] Adopt new VS Error List API

# Changelog

These are the changes to each version that has been released
on the official Visual Studio extension gallery

## 5.2

- [x] NUglify got updated to 1.20.2

## 5.1

- [x] NUglify got updated to 1.20.0
- [x] Added support for .net 6.0

## 5.0

- [x] Renamed to `BundlerMinifierPlus` to maintain the nuget package.
- [x] Added support to .net 5.0

## 2.4

- [x] .csproj based ASP.NET Core apps support bundle-on-build
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
A Visual Studio extension that let's you configure bundling and
minification of JS, CSS and HTML files.

Download the extension at the
Package name is now `BuildBundlerMinifierPlus`, build the projects then use local Nuget repository to get access to it. Here is list of paackages:

* [BuildBundlerMinifierPlus](https://www.nuget.org/packages/BuildBundlerMinifierPlus/) version 5.2
* [BundlerMinifierPlus.Core](https://www.nuget.org/packages/BundlerMinifierPlus.Core/) version 5.2
* [BundlerMinifierPlus.TagHelpers](https://www.nuget.org/packages/BundlerMinifierPlus.TagHelpers/) version 5.2


Download the extension (for [this repo](https://github.com/failwyn/BundlerMinifier)) at the
[VS Gallery](https://visualstudiogallery.msdn.microsoft.com/9ec27da7-e24b-4d56-8064-fd7e88ac1c40)

---------------------------------------
Expand Down
13 changes: 8 additions & 5 deletions src/BundlerMinifier.Core/BundlerMinifier.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
<Import Project="..\common.props" />

<PropertyGroup>
<Version>1.0.0</Version>
<TargetFrameworks>netcoreapp1.0;net452;netcoreapp2.0;netstandard2.0;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);DOTNET</DefineConstants>
<AssemblyName>dotnet-bundle</AssemblyName>
<Authors>Mads Kristensen, salar2k</Authors>
<OutputType>Exe</OutputType>
<PackageId>BundlerMinifier.Core</PackageId>
<PackageId>BundlerMinifierPlus.Core</PackageId>
<RepositoryUrl>https://github.com/salarcode/BundlerMinifierPlus</RepositoryUrl>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AssemblyVersion>5.2</AssemblyVersion>
<FileVersion>5.2</FileVersion>
<Version>5.2</Version>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,7 +32,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUglify" Version="1.17.10" />
<PackageReference Include="NUglify" Version="1.20.2" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>

Expand Down
5 changes: 4 additions & 1 deletion src/BundlerMinifier.TagHelpers/BundleTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public BundleTagHelper(IWebHostEnvironment hostingEnvironment, IMemoryCache cach
[HtmlAttributeName("name")]
public string BundleName { get; set; }

[HtmlAttributeName("type")]
public string ScriptType {get; set;} = "text/javascript";

public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.SuppressOutput();
Expand All @@ -74,7 +77,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)

if (bundle.OutputFileUrl.EndsWith(".js", StringComparison.OrdinalIgnoreCase))
{
output.Content.AppendHtmlLine($"<script src=\"{_htmlEncoder.Encode(src)}\" type=\"text/javascript\"></script>");
output.Content.AppendHtmlLine($"<script src=\"{_htmlEncoder.Encode(src)}\" type=\"{ScriptType}\"></script>");
}
else if (bundle.OutputFileUrl.EndsWith(".css", StringComparison.OrdinalIgnoreCase))
{
Expand Down
14 changes: 9 additions & 5 deletions src/BundlerMinifier.TagHelpers/BundlerMinifier.TagHelpers.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>

<Authors>Gérald Barré, Mads Kristensen, RockstarDev</Authors>
<Authors>Gérald Barré, Mads Kristensen, RockstarDev, salar2k</Authors>
<Product>Bundler &amp; Minifier TagHelpers</Product>
<PackageLicenseUrl>https://github.com/madskristensen/BundlerMinifier/blob/master/LICENSE</PackageLicenseUrl>
<Copyright>Copyright © 2018</Copyright>
<PackageLicenseUrl>https://github.com/salarcode/BundlerMinifierPlus/blob/master/LICENSE</PackageLicenseUrl>
<Copyright>Copyright 2022</Copyright>
<PackageIconUrl>https://raw.githubusercontent.com/madskristensen/BundlerMinifier/master/src/BundlerMinifierVsix/Resources/icon.png</PackageIconUrl>
<RepositoryUrl>https://github.com/madskristensen/BundlerMinifier</RepositoryUrl>
<RepositoryUrl>https://github.com/salarcode/BundlerMinifierPlus</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>concat;bundle;minify;minification;css;js;html;aspnet;netcore</PackageTags>
<!-- forces SDK to copy dependencies into build output to make packing easier -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AssemblyVersion>5.2</AssemblyVersion>
<FileVersion>5.2</FileVersion>
<Version>5.2</Version>
<PackageId>BundlerMinifierPlus.TagHelpers</PackageId>
</PropertyGroup>

<ItemGroup>
Expand Down
19 changes: 12 additions & 7 deletions src/BundlerMinifier/BundlerMinifier.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@
<Import Project="..\common.props" />

<PropertyGroup>
<TargetFrameworks>net46;netstandard1.3;netcoreapp2.0;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net46;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<Title>Bundler &amp; Minifier</Title>
<PackageId>BuildBundlerMinifier</PackageId>
<PackageId>BuildBundlerMinifierPlus</PackageId>

<BuildOutputTargetFolder>tools</BuildOutputTargetFolder>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoPackageAnalysis>true</NoPackageAnalysis>
<!-- forces SDK to copy dependencies into build output to make packing easier -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PackageIconUrl>https://raw.githubusercontent.com/madskristensen/BundlerMinifier/master/src/BundlerMinifierVsix/Resources/icon.png</PackageIconUrl>
<PackageLicenseUrl>https://github.com/madskristensen/BundlerMinifier/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/failwyn/BundlerMinifier</RepositoryUrl>
<PackageLicenseUrl>https://github.com/salarcode/BundlerMinifierPlus/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/salarcode/BundlerMinifierPlus</RepositoryUrl>
<PackageTags>concat;bundle;minify;minification;css;js;html</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Authors>Mads Kristensen, salar2k</Authors>
<Copyright>Copyright 2022</Copyright>
<AssemblyVersion>5.2</AssemblyVersion>
<FileVersion>5.2</FileVersion>
<Version>5.2</Version>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,10 +32,10 @@


<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="15.1.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.1.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Framework" Version="15.9.20" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.9.20" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" PrivateAssets="All" />
<PackageReference Include="NUglify" Version="1.17.10" PrivateAssets="All" />
<PackageReference Include="NUglify" Version="1.20.2" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_BundlerMinifierTaskAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">..\tools\netstandard1.3\BundlerMinifier.dll</_BundlerMinifierTaskAssembly>
<_BundlerMinifierTaskAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">..\tools\net6.0\BundlerMinifier.dll</_BundlerMinifierTaskAssembly>
<_BundlerMinifierTaskAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">..\tools\net46\BundlerMinifier.dll</_BundlerMinifierTaskAssembly>
</PropertyGroup>

Expand Down
8 changes: 4 additions & 4 deletions src/BundlerMinifierTest/BundlerMinifierTest.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<TargetFrameworks>net46</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

Expand All @@ -10,9 +10,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.12" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BundlerMinifierTest/BundlerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void Process()

// CSS
string cssResult = File.ReadAllText(new FileInfo("../../../artifacts/foo.min.css").FullName);
Assert.AreEqual("body{background:url('/test.png')}body{display:block}body{background:url(test2/image.png?foo=hat)}", cssResult);
Assert.AreEqual("body{background:url('/test.png')}body{display:block}:root{--bb-width-test:}body{background:url(test2/image.png?foo=hat)}", cssResult);

// HTML
string htmlResult = File.ReadAllText("../../../artifacts/foo.min.html");
Expand Down
5 changes: 4 additions & 1 deletion src/BundlerMinifierTest/artifacts/file2.css
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
body {display: block}
body {display: block}
:root{
--bb-width-test: ;
}
12 changes: 6 additions & 6 deletions src/BundlerMinifierVsix/BundlerMinifierVsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -199,24 +199,24 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.SDK">
<Version>17.0.0-previews-3-31605-261</Version>
<Version>17.2.32505.173</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Utilities">
<Version>17.0.0-previews-3-31605-261</Version>
<Version>17.2.32505.113</Version>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools">
<Version>17.0.4183-preview4</Version>
<Version>17.2.2195</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>9.0.1</Version>
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="NuGet.VisualStudio">
<Version>3.5.0</Version>
<Version>17.2.1</Version>
</PackageReference>
<PackageReference Include="NUglify">
<Version>1.17.10</Version>
<Version>1.20.2</Version>
</PackageReference>
</ItemGroup>
<!-- end workaround -->
Expand Down
4 changes: 2 additions & 2 deletions src/BundlerMinifierVsix/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<Identity Id="5783ce1f-b23d-4e84-87a4-6b2cbe9e0602" Version="2.9.3" Language="en-US" Publisher="Jason Moore" />
<DisplayName>Bundler &amp; Minifier 2022+</DisplayName>
<Description xml:space="preserve">Adds support for bundling and minifying JavaScript, CSS and HTML files in any project.</Description>
<MoreInfo>https://github.com/failwyn/BundlerMinifier</MoreInfo>
<MoreInfo>https://github.com/salarcode/BundlerMinifierPlus</MoreInfo>
<License>Resources\LICENSE</License>
<ReleaseNotes>https://github.com/failwyn/BundlerMinifier/blob/master/CHANGELOG.md</ReleaseNotes>
<ReleaseNotes>https://github.com/salarcode/BundlerMinifierPlus/blob/master/CHANGELOG.md</ReleaseNotes>
<Icon>Resources\icon.png</Icon>
<PreviewImage>Resources\preview.png</PreviewImage>
<Tags>bundle, bundling, minify, minification, js, css, html</Tags>
Expand Down