Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dzonatan/base-href-webpack-plugin
Webpack plugin for inserting base href tag in head block
https://github.com/dzonatan/base-href-webpack-plugin
base-href base-tag webpack webpack-plugin
Last synced: about 2 months ago
JSON representation
Webpack plugin for inserting base href tag in head block
- Host: GitHub
- URL: https://github.com/dzonatan/base-href-webpack-plugin
- Owner: dzonatan
- License: mit
- Created: 2016-07-29T10:54:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-20T06:49:03.000Z (over 2 years ago)
- Last Synced: 2024-11-08T05:44:05.791Z (2 months ago)
- Topics: base-href, base-tag, webpack, webpack-plugin
- Language: JavaScript
- Size: 225 KB
- Stars: 22
- Watchers: 1
- Forks: 9
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# base-href-webpack-plugin (extension)
[![npm version](https://badge.fury.io/js/base-href-webpack-plugin.svg)](https://badge.fury.io/js/base-href-webpack-plugin)
Extension for [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin) to programmatically insert or update `` tag.
# Deprecation notice ⚠️
You probably don't need this plugin as `html-webpack-plugin` supports this [feature natively](https://github.com/jantimon/html-webpack-plugin#base-tag).
# Prerequisites
This plugin is an extension of [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin).
So make sure you have installed `npm i --save-dev html-webpack-plugin`.# Installation
For webpack v5 use latest (^3.0.0):
`npm i --save-dev base-href-webpack-plugin`For webpack v4 use ^2.0.0:
`npm i --save-dev base-href-webpack-plugin@2`For webpack v3 use ^1.0.0:
`npm i --save-dev base-href-webpack-plugin@1`# Usage
```javascript
const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin');// Add to plugins
plugins: [
new HtmlWebpackPlugin(), // Required dependency
new BaseHrefWebpackPlugin({ baseHref: '/' })
]
```Plugin **leaves your template untouched** if `baseHref` option is not provided.
# Contribution
Feel free to contribute to this project by submitting issues and/or pull requests.
# License
MIT