{"id":15625751,"url":"https://github.com/daniel15/webpacktag","last_synced_at":"2025-04-28T15:52:32.568Z","repository":{"id":139345697,"uuid":"221401134","full_name":"Daniel15/WebpackTag","owner":"Daniel15","description":"ASP.NET Core Tag Helper for Webpack assets","archived":false,"fork":false,"pushed_at":"2019-11-16T19:16:55.000Z","size":338,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-28T15:52:26.235Z","etag":null,"topics":["aspnetcore","webpack","webpack-assets","webpack-assets-manifest","webpack-dev-server","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://d.sb/webpacktag","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Daniel15.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-13T07:44:45.000Z","updated_at":"2022-10-08T07:55:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"c88fc676-e886-4e85-a37a-ddd66e47ae60","html_url":"https://github.com/Daniel15/WebpackTag","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FWebpackTag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FWebpackTag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FWebpackTag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FWebpackTag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daniel15","download_url":"https://codeload.github.com/Daniel15/WebpackTag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342718,"owners_count":21574243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnetcore","webpack","webpack-assets","webpack-assets-manifest","webpack-dev-server","webpack-plugin"],"created_at":"2024-10-03T10:02:47.284Z","updated_at":"2025-04-28T15:52:32.544Z","avatar_url":"https://github.com/Daniel15.png","language":"C#","readme":"# WebpackTag\n\n[![NuGet version](http://img.shields.io/nuget/v/WebpackTag.svg)](https://www.nuget.org/packages/WebpackTag/)\n\nWebpackTag is an [ASP.NET Core Tag Helper](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro?view=aspnetcore-3.0) for rendering links to CSS and JS files compiled via Webpack\n\n* Supports both [webpack-manifest-plugin](https://www.npmjs.com/package/webpack-manifest-plugin) (as used by [Create React App](https://create-react-app.dev/)) and [assets-webpack-plugin](https://www.npmjs.com/package/assets-webpack-plugin).\n* Supports loading manifest from Webpack devserver in development.\n* Renders [preload headers](https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content) for improved performance. This can be used to support [HTTP/2 Server Push in Nginx](https://www.nginx.com/blog/nginx-1-13-9-http2-server-push/#automatic-push).\n\n# Usage\n\nInstall the  `WebpackTag` library using NuGet\n\nAdd the WebpackTag services to your `Startup.cs`:\n\n```csharp\nusing WebpackTag;\n...\npublic void ConfigureServices(IServiceCollection services)\n{\n\tservices.AddWebpackTag();\n```\n\nImport the tag helpers in your `Views/_ViewImports.cshtml` file:\n\n```csharp\n@addTagHelper *, WebpackTag\n```\n\nThen use the tag helpers in your view!\n\n```html\n\u003cwebpack-styles /\u003e\n\u003cwebpack-scripts /\u003e\n```\n\nThese tag helpers will look for files called `webpack-assets.json` or `asset-manifest.json` in your wwwroot or SPA root directory, parse the contents, and render the correct `\u003clink\u003e` or `\u003cstyle\u003e` tags.\n\nNote that when using `assets-webpack-plugin`, the `entrypoints` option should be **enabled**.\n\n## Multiple entry points\n\nIf your app has multiple entry points, you may specify the entry point name when using the tag\n\n```html\n\u003cwebpack-styles entry=\"first\" /\u003e\n```\n\n## Configuration\n\nAdditional configuration can be performed when registering the services:\n\n```csharp\nservices.AddWebpackTag(options =\u003e\n{\n\t// ...\n});\n```\n\nThe following configuration options are available:\n\n* `DevServerPort`: Port the Webpack devserver is running on. If this is configured, the tag helpers will try hitting `http://localhost:{port}/asset-manifest.json` to load the manifest.\n* `BaseUrl`: Sets a string to prefix the generated URLs with. For example, this can be used to use a separate CDN domain in prod:\n\n```csharp\npublic class Startup\n{\n\tprivate readonly IWebHostEnvironment _env;\n\n\tpublic Startup(IConfiguration configuration, IWebHostEnvironment env)\n\t{\n\t\t_env = env;\n\t\tConfiguration = configuration;\n\t}\n\n\tpublic void ConfigureServices(IServiceCollection services)\n\t{\n\t\tservices.AddWebpackTag(options =\u003e\n\t\t{\n\t\t\toptions.BaseUrl = _env.IsDevelopment() ? \"/\" : \"https://cdn.example.com/\";\n\t\t});\n\t\t// ...\n```\n\n# Samples\n\nThis repository contains two samples:\n\n* `WebpackTag.Samples.React`: Uses the [ASP.NET Core 3.0 React project template](https://docs.microsoft.com/en-us/aspnet/core/client-side/spa/react?view=aspnetcore-3.0\u0026tabs=visual-studio), which uses Create React App.\n* `WebpackTag.Samples.WebpackAssets`: Basic example using [assets-webpack-plugin](https://www.npmjs.com/package/assets-webpack-plugin).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Fwebpacktag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel15%2Fwebpacktag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Fwebpacktag/lists"}