1.0.1 • Published 3 years ago
html-webpack-dotnet-versionize-plugin v1.0.1
Html Webpack Dotnet Versionize Plugin
A plugin for webpack-html-plugin to add .net framework's ToVersionizeSC() method to the scripts and styles
Useful when you create .cshtml file instead of .html file with html-webpack-plugin.
Configuration
- Install via
npm i -D html-webpack-dotnet-versionize-plugin
oryarn add -D html-webpack-dotnet-versionize-plugin
- Add to your webpack config AFTER HtmlWebpackPlugin
const HtmlWebpackDotnetVersionizePlugin = require('html-webpack-dotnet-versionize-plugin');
...
plugins: [
new HtmlWebpackPlugin({
filename: path.join(__dirname, 'Sample/Path/Views/Account/MyAccount.cshtml'),
template: path.join(__dirname, 'Sample/Path/Templates/MyAccount.ejs'),
minify: false,
}),
new HtmlWebpackDotnetVersionizePlugin()
]
Sample Output
<html>
<head>
<meta charset="utf-8">
<title>Webpack App</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link href="@("/css/main.css".ToVersionizeSC())" rel="stylesheet"/>
</head>
<body>
<script src="@("/js/main.js".ToVersionizeSC())"></script></body>
</html>
Testing
I'm planning to write test in future. Currently you can test the plugin manually.
Install npm packages then run npm run test:build
. You can see result in test/index.html file.