New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@isunkui/gulp-html-url-prefix-suffix

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isunkui/gulp-html-url-prefix-suffix

a gulp plugin for set html url prefix and suffix version.

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

gulp-html-url-prefix

a plugin of gulp for cdn prefix or suffix version url

install

npm i @isunkui/gulp-html-url-prefix-suffix -D

options

  • options - type: object
    • prefix: String, default
    • suffix: Boolean, default false
    • attrdata: Array, default ["img:src", "img:srcset", "img:s-src", "img:data-src", "script:src", "link:href"]
urlPrefix({
  prefix: '//cdn.xxx.com'
})

example

index.html

<!DOCTYPE html>
<html>
  <head>
    <link href="./css/example.css" />
  </head>
  <body>
    <img src="./example.jpg" />
    <script type="text/javascript" src="./js/example.js"></script>
  </body>
</html>

gulpfile.js

var urlPrefix = require('gulp-html-url-prefix'),
  gulp = require('gulp');

gulp.task('url', function() {
  gulp.src(['index.html'])
    .pipe(urlPrefix({
      prefix: '//cdn.xxx.com',
      suffix: true, // url末尾追加 ?v=1545376218218
      attrdata: ["img:src", "img:srcset", "img:s-src", "img:data-src", "script:src", "link:href"]  //自定义标签属性
    }))
    .pipe(gulp.dest('./'));
});

and the result is:

<!DOCTYPE html>
<html>
  <head>
    <link href="//cdn.xxx.com/css/example.css?v=1545376218218" />
  </head>
  <body>
    <img src="//cdn.xxx.com/example.jpg?v=1545376218218" />
    <script type="text/javascript" src="//cdn.xxx.com/js/example.js?v=1545376218218"></script>
  </body>
</html>

License

MIT

Keywords

gulp

FAQs

Package last updated on 21 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts