GithubHelp home page GithubHelp logo

daskott / gulp-version-filename Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brwnll/gulp-version-filename

0.0 2.0 0.0 21 KB

Gulp plugin for pulling versioning from a file and add it to the filename. Particularly useful for doing semvers on your JS libraries and CSS files.

CSS 17.53% HTML 46.32% JavaScript 36.15%

gulp-version-filename's Introduction

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'));
});

gulp-version-filename's People

Contributors

brwnll avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.