UNPKG

lilacs

Version:

A web frontend building tool for teamwork, with automaticly compiling, merging, minifying, syncing files to server, supporting distributed servers, ensuring css or html files' inline reference with correct absolute path, and more.

51 lines (44 loc) 1.87 kB
var cssUrlToAbsolute = require('../../lib/gulp-css-url-to-absolute'); var cdnAbsolutePath = require('../../lib/gulp-cdn-absolute-path'); var cssUrlPrefix = require('../../lib/gulp-css-url-prefix'); var distData = require('./data'); module.exports = { /** * 1. relative to absolute * * 2. add cssAbsolutePathPrefix */ adjustCss: (gulp) => { return function adjustCss() { var stream = gulp.src(distData.currentConfig.buildPaths.dist.css + '/**/*.css'); if (distData.currentConfig.cssAbsolutePath) stream.pipe(cssUrlToAbsolute({ root: distData.currentConfig.basePaths.webRoot })); if (distData.currentConfig.currentNetworkOption.cssAbsolutePathPrefix) stream.pipe(cssUrlPrefix( distData.currentConfig.currentNetworkOption.cssAbsolutePathPrefix, '\/' )); return stream.pipe(gulp.dest(distData.currentConfig.buildPaths.distTmp.css)); } }, /** * 1. relative to absolute * * 2. add cdn */ adjustHtml: (gulp) => { return function adjustHtml() { if (distData.currentConfig.htmlAbsoluteAndCdnPath) return gulp.src(distData.currentConfig.buildPaths.dist.html + '/**/*.html') .pipe(cdnAbsolutePath({ asset: distData.currentConfig.basePaths.webRoot, cdn: distData.currentConfig.currentNetworkOption.staticDomain || '' })) .pipe(gulp.dest(distData.currentConfig.buildPaths.distTmp.html)); else return gulp.src(distData.currentConfig.buildPaths.dist.html + '/**/*.html') .pipe(gulp.dest(distData.currentConfig.buildPaths.distTmp.html)); } } };