gulp-version-filename

2.0.0 • Public • Published

Gulp Version Filename circle ci code climate Test Coverage npm version

Takes the version number from within a file and adds it to the filename. This is specifically useful for pipelines outputting JS or CSS files. Allows for versioning controlled by you, instead of a hash, allowing for the use of human understandable sequencing (such as semver).

eg: myjslibrary-2.1.0.min.js

How to Use

Install module.

npm i gulp-version-filename

Somewhere Within Your CSS/JS/etc File

/**
 * My File
 * @version 8.12.12
 */

gulpfile.js

 
var filever = require('gulp-version-filename');
 
/**
 * Takes the version number and adds it to the filename
 */
gulp.task('rename', function() {
  return gulp.src(['newcssfile.css'])
    .pipe(filever())
    .pipe(gulp.dest('dist'));
});
 
gulp rename

You should now have

dist/newcssfile-8.12.12.css

Options

  • key

    Pass to change the version variable tag within the file, defaults to 'version'

  • silent

    Pass to suppress errors thrown if the version parameter is not found within a file.

gulp.task('rename', function() {
  return gulp.src(['*.css', '*.js'])
    .filever({
      key: 'package', // Searches for @package
      silent: true // Suppress errors if file is missing @package
    })
    .pipe(gulp.dest('dist'));
});

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i gulp-version-filename

    Weekly Downloads

    24

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    53 kB

    Total Files

    21

    Last publish

    Collaborators

    • brwnll