Used to merge image files into one directory without modifying any web code. It supports both css files and html files.
Usage
var gulp = gulpif = mergeAsset = ; gulp;
The referred asset files(imgs, videos, audios, etc.) will be copied to folder: 'merged-assets' with name changed to "SHA1-XXXX"('XXXX' is the sha1 value of the referred asset) style. The source files will be deleted with deleteSrcAsset
set to true.
Options
options.fileStore
Type: Object
Default: null
File store is used to store the relationship between the original asset path and the expected calculated final path.
Set to {}
to satisfy use case: 'One asset is referred for more than one times'.
options.fileType
Type: String
Default: css
Currently only css
and html
are supported(case insensitive).
options.deleteSrcAsset
Type: Boolean
Default: false
Whether or not delete the source files when merging assets.
Be cautious when set as true
if the same file will be processed more than 1 times.
options.targetDirAbsolutePath
Type: String
Default: merged-assets
The target folder where asset files will be merged into.
options.resolveReferenceRelativeTo
Type: String
Default: path.dirname(currentVinylFilePath)
The base folder used to resolve new relative path to refer merged img.
License
MIT