1.0.1 • Published 10 years ago

grunt-relative-root v1.0.1

Weekly downloads
92
License
-
Repository
github
Last release
10 years ago

grunt-relative-root

Build Status Dependency Status NPM Version

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:

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 and npm so you can install this in your project

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'.

1.0.1

10 years ago

1.0.0

10 years ago

0.5.0

11 years ago

0.4.0

11 years ago

0.3.0

11 years ago

0.2.2

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.0

13 years ago