1.3.0 • Published 6 years ago

gulp-html-rename v1.3.0

Weekly downloads
15
License
MIT
Repository
github
Last release
6 years ago

gulp-html-rename NPM

An HTML, CSS and JavaScript id and class minimiser.

This plugin only renames ids with a prefix of id- and classes with a prefix of class-. You can specify more prefixes though the options object.

Polymer element names are included by default (iron-, paper-, ...)

Usage

First, install gulp-html-rename as a development dependency:

npm install --save-dev gulp-html-rename

Then, add it to your gulpfile.js:

Default Rename

const gulpHTMLRename = require('gulp-html-rename');

gulp.task('rename', function(){
  gulp.src(['build/**/*'])
    .pipe(gulpHTMLRename())
    .pipe(gulp.dest('build/'));
});

Custom Replace

const gulpHTMLRename = require('gulp-html-rename');
const options = [
  'my-id-'
];

gulp.task('rename', function(){
  gulp.src(['build/**/*'])
    .pipe(gulpHTMLRename(options))
    .pipe(gulp.dest('build/'));
});

Custom File extensions

html, css and js are included by default

const gulpHTMLRename = require('gulp-html-rename');

gulp.task('rename', function(){
  gulp.src(['build/**/*'])
    .pipe(htmlRename([], ['ts']))
    .pipe(gulp.dest('build/'));
});

API

gulp-html-rename can be called with options.

gulpHTMLRename(options, allowedExtensions)

options

Type: Array

The array with prefix strings.

allowedExtensions

Type: Array

The array with file extensions.

1.3.0

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.0

9 years ago