npm.io
1.3.0 • Published 8 years ago

gulp-html-rename

Licence
MIT
Version
1.3.0
Deps
2
Size
19 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

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.

Keywords