# grunt-relative-root

> Relativize absolute paths in HTML and CSS

Latest version **1.0.1** (published 2016-11-10) · 0 weekly downloads

## Install

```sh
npm install grunt-relative-root
pnpm add grunt-relative-root
yarn add grunt-relative-root
bun add grunt-relative-root
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-11-10 |
| First published | 2013-06-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adam Hull |
| Maintainers | hurrymaplelad |
| Keywords | gruntplugin, relative, url, root |

## Links

- npm: https://www.npmjs.com/package/grunt-relative-root
- Repository: https://github.com/hurrymaplelad/grunt-relative-root
- Issues: https://github.com/hurrymaplelad/grunt-relative-root/issues
- npm.io page: https://npm.io/package/grunt-relative-root

## Dependencies (1)

- [slash](https://npm.io/package/slash.md) ^1.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-11-10
- 1.0.0 — 2016-10-28
- 0.5.0 — 2015-11-09
- 0.4.0 — 2015-10-16
- 0.3.0 — 2015-06-18
- 0.2.2 — 2014-08-29
- 0.2.1 — 2014-02-10
- 0.2.0 — 2014-02-02
- 0.1.0 — 2013-06-18

## README

# grunt-relative-root
[![Build Status](https://img.shields.io/travis/hurrymaplelad/grunt-relative-root.svg?style=flat-square)](https://travis-ci.org/hurrymaplelad/grunt-relative-root)
[![Dependency Status](https://img.shields.io/gemnasium/hurrymaplelad/grunt-relative-root.svg?style=flat-square)](https://gemnasium.com/hurrymaplelad/grunt-relative-root)
[![NPM Version](https://img.shields.io/npm/v/grunt-relative-root.svg?style=flat-square)](https://www.npmjs.com/package/grunt-relative-root)

Relativize absolute paths in HTML and CSS.

You built some static website.  Maybe you're gonna host it on gh-pages.  Maybe you're squating a stellar domain name, but you'd rather review the site on `<yourname>.github.io/<yourproject>` before you repoint DNS.  How do you make your pages work from both `/<yourproject/` and `/`?

Add something like this to your Gruntfile:

```js
grunt.loadNpmTasks('grunt-relative-root');

grunt.initConfig({
  relativeRoot: {
    yourTarget: {
      options: {
        root: 'public'
      },
      files: [{
        expand: true,
        cwd: '<%= relativeRoot.yourTarget.options.root %>',
        src: ['*.css', '*.html'],
        dest: 'out/'
      }]
    }
  }
})
```
## Getting Started
You should be comfy with the [grunt basics](http://gruntjs.com/getting-started) and [npm](https://npmjs.org/doc/README.html) so you can install this in your project

```shell
npm install grunt-relative-root --save-dev
```

## Options

#### root
Type: `String`
Default value: `'.'`

Local directory used as the base for relative paths. If `root: 'public'` then the URL `'/images/logo.png'` in the file `'public/events/solstice.html'` will be rewritten as `'../image/logo.png'`.

---
_Source: https://npm.io/package/grunt-relative-root · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
