1.3.0 • Published 6 years ago
gulp-html-rename v1.3.0
gulp-html-rename
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.