Skip to content

Commit 217da3d

Browse files
authored
chore(CssBundler): add css-bundler tools (#6841)
* chore: 增加 css-bundler 工具 * chore: 增加配置 * chore: 删除生成文件 * chore: 更新打包配置 * chore: 集成打包工具 * chore: 更新打包配置文件 * chore: 更新忽略文件 * chore: 更新样式配置文件 * doc: 增加本地化 * doc: 更新 ColorPicker 示例 * refactor: 更改为增量执行 * chore: 更改任务名称 * test: 更新单元测试 * chore: bump version 9.11.1-beta05 * refactor: 更新脚本 * chore: 更新脚本
1 parent 04bec17 commit 217da3d

File tree

7 files changed

+57
-23
lines changed

7 files changed

+57
-23
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,6 @@ src/**/wwwroot/**/uploader
376376
# Bootstrap
377377
**/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js
378378
**/BootstrapBlazor/wwwroot/css/bootstrapblazor.min.css
379+
380+
# css
381+
**/BootstrapBlazor/wwwroot/css/bootstrap.blazor.bundle.*.css

dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"bootstrapblazor.cssbundler": {
6+
"version": "1.0.0",
7+
"commands": [
8+
"css-bundler"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.11.1-beta04</Version>
4+
<Version>9.11.1-beta05</Version>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -10,18 +10,16 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<Content Remove="wwwroot\core\bootstrap\css\bootstrap.css" />
14-
<Content Remove="wwwroot\core\bootstrap\css\bootstrap.rtl.css" />
15-
<Content Remove="wwwroot\core\bootstrap\js\bootstrap.bundle.js" />
16-
<Content Remove="wwwroot\core\bootstrap\js\bootstrap.bundle.min.js" />
17-
<Content Remove="wwwroot\lib\swal\sweetalert2.css" />
13+
<Content Remove="wwwroot\core\bootstrap\**\*.*" />
14+
<Content Remove="wwwroot\lib\animate\*.css" />
15+
<Content Remove="wwwroot\lib\swal\*.css" />
1816
<Content Remove="wwwroot\scss\*" />
19-
<None Include="wwwroot\core\bootstrap\css\bootstrap.css" />
20-
<None Include="wwwroot\core\bootstrap\css\bootstrap.rtl.css" />
21-
<None Include="wwwroot\core\bootstrap\js\bootstrap.bundle.js" />
22-
<None Include="wwwroot\core\bootstrap\js\bootstrap.bundle.min.js" />
23-
<None Include="wwwroot\lib\swal\sweetalert2.css" />
17+
<Content Remove="wwwroot\css\bootstrapblazor.min.css" />
18+
<None Include="wwwroot\core\bootstrap\**\*.*" />
19+
<None Include="wwwroot\lib\animate\*.css" />
20+
<None Include="wwwroot\lib\swal\*.css" />
2421
<None Include="wwwroot\scss\*" />
22+
<None Include="wwwroot\css\bootstrapblazor.min.css" />
2523
</ItemGroup>
2624

2725
<ItemGroup>

src/BootstrapBlazor/Directory.Build.targets

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@
77
</ItemGroup>
88

99
<PropertyGroup>
10-
<BootstrapBundleFile>$(MSBuildThisFileDirectory)wwwroot/core/bootstrap/js/bootstrap.bundle.min.js</BootstrapBundleFile>
11-
<TargetBootstrapBundleFile>$(MSBuildThisFileDirectory)wwwroot/js/bootstrap.blazor.bundle.min.js</TargetBootstrapBundleFile>
10+
<BootstrapOriginJsFile>$(MSBuildThisFileDirectory)wwwroot/core/bootstrap/js/bootstrap.bundle.min.js</BootstrapOriginJsFile>
11+
<BootstrapTargetJsFile>$(MSBuildThisFileDirectory)wwwroot/js/bootstrap.blazor.bundle.min.js</BootstrapTargetJsFile>
12+
<StyleFile>$(MSBuildThisFileDirectory)wwwroot/css/bootstrapblazor.min.css</StyleFile>
13+
<BundleStyleFile>$(MSBuildThisFileDirectory)wwwroot/css/bootstrap.blazor.bundle.min.css;$(MSBuildThisFileDirectory)wwwroot/css/bootstrap.blazor.bundle.rtl.min.css</BundleStyleFile>
1214
</PropertyGroup>
1315

14-
<Target Name="CopyCss" AfterTargets="Build" Condition="'$(TargetFramework)' == '$(RunTargetFramework)'">
16+
<Target Name="CopyJs" AfterTargets="Build" Condition="'$(TargetFramework)' == '$(RunTargetFramework)'" Inputs="$(BootstrapOriginJsFile)" Outputs="$(BootstrapTargetJsFile)">
1517
<Message Text="Copy bootstrap.bundle.min.js ..." Importance="high"></Message>
16-
<Copy SourceFiles="$(BootstrapBundleFile)" DestinationFiles="$(TargetBootstrapBundleFile)" SkipUnchangedFiles="true"></Copy>
18+
<Copy SourceFiles="$(BootstrapOriginJsFile)" DestinationFiles="$(BootstrapTargetJsFile)" SkipUnchangedFiles="true"></Copy>
19+
</Target>
20+
21+
<Target Name="CssBundler" AfterTargets="CopyJs" Condition="'$(TargetFramework)' == '$(RunTargetFramework)'" Inputs="$(StyleFile)" Outputs="$(BundleStyleFile)">
22+
<Message Text="Bundler min css ..." Importance="high"></Message>
23+
<Exec Command="dotnet tool restore"></Exec>
24+
<Exec Command="dotnet css-bundler $(MSBuildThisFileDirectory)bundler.json"></Exec>
1725
</Target>
1826

1927
</Project>

src/BootstrapBlazor/bundler.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[
2+
{
3+
"outputFileName": "wwwroot/css/bootstrap.blazor.bundle.min.css",
4+
"inputFiles": [
5+
"wwwroot/core/bootstrap/css/bootstrap.min.css",
6+
"wwwroot/css/bootstrapblazor.min.css",
7+
"wwwroot/lib/animate/animate.min.css",
8+
"wwwroot/lib/swal/sweetalert2.min.css"
9+
]
10+
},
11+
{
12+
"outputFileName": "wwwroot/css/bootstrap.blazor.bundle.rtl.min.css",
13+
"inputFiles": [
14+
"wwwroot/core/bootstrap/css/bootstrap.rtl.min.css",
15+
"wwwroot/css/bootstrapblazor.min.css",
16+
"wwwroot/lib/animate/animate.min.css",
17+
"wwwroot/lib/swal/sweetalert2.min.css"
18+
]
19+
}
20+
]

src/BootstrapBlazor/wwwroot/css/bootstrap.blazor.bundle.min.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/BootstrapBlazor/wwwroot/css/bootstrap.blazor.bundle.rtl.min.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)