0.0.6 • Published 7 years ago

gulp-relative-replace v0.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

gulp-relative-replace

NPM version Download stats

NPM stats

Replace build placeholder to relative path.

Table of Contents

Usage

Install:

npm install --save-dev gulp-relative-replace

API

relativeReplace(options)

options

Type: object

  • {String} placeholder - The placeholder you want to replace. Default: @___RELATIVE_REPLACE_HOLDER__@
  • {String} from - The path relative from.
  • {String} to - The path relative to.
Options example:
relativeReplace({
  form : './build/'
})

Example

index.html:

<!DOCTYPE html>
<html>
    <head>
  
    <link rel="stylesheet" href="@___RELATIVE_REPLACE_HOLDER__@normalize.css">
    </head>
    <body>

    <img src="@___RELATIVE_REPLACE_HOLDER_2__@bg.jpg">

gulpfile.js:

var gulp = require('gulp');
var relativeReplace = require('gulp-relative-replace');

gulp.task('default', function() {
  gulp.src('index.html')
    .pipe(relativeReplace({
      to './build/html/css' //build/html -> /build/html/css
    }))
    .pipe(relativeReplace({
      placeholder : '@___RELATIVE_REPLACE_HOLDER_2__@',
      from './build/imgs' // build/imgs -> build/html
    }))
    .pipe(gulp.dest('build/html'));
});

Result:

<!DOCTYPE html>
<html>
    <head>

    <link rel="stylesheet" href="css/styles.min.css">

    </head>
    <body>
  
    <img src="../imgs/bg.jpg">
0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago