Coder Social home page Coder Social logo

gulp-rev-cto's Introduction

gulp-rev-cto

gulp-rev-cto 是基于 gulp-rev & gulp-rev-collector改造,将 hash 值置于文件后,避免生成多个的文件,同时封装 rev-collector, 无需安装两个依赖。

Install

$ npm install --save-dev gulp-rev-cto

Usage

const gulp = require('gulp');
const rev = require('gulp-rev-cto');
const { revCollector } = rev;
gulp.task('default', () =>
    gulp.src('src/*.css')
    .pipe(rev())
    .pipe(rev.manifest({ merge: true }))
        .pipe(gulp.dest('dist'))
);
// or
gulp.task('default', () =>
    gulp.src('src/*.html')
    .pipe(revCollector({
        replaceReved: true,
    }))
        .pipe(gulp.dest('dist'))
);

// 新增manifest【resourceUrl】参数 生成的json中的value值会拼接该字段,用于全局替换
gulp.task('default', () =>
    gulp.src('src/*.css')
    .pipe(rev())
    .pipe(rev.manifest({
        resourceUrl:'//cnd.xxx.com/cdn/'
    }))
        .pipe(gulp.dest('dist'))
);

//---->生成的文件
{
  "images/default/icon/A.png": "//cnd.xxx.com/cdn/images/default/icon/A.png?v=b8acf03fca",
}

API

参考gulp-rev & gulp-rev-collector

gulp-rev-cto's People

Contributors

ctoweb1 avatar

Watchers

ndwxhm 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.