Created
July 21, 2017 15:03
-
-
Save Slauta/fe7c5f3a0a3e706bbdaacf34b329dd44 to your computer and use it in GitHub Desktop.
Wiredrap min.js insert fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return gulp.src(BUILD_DIR+'/index.html') | |
.pipe(wiredep({ | |
ignorePath: "../../"+APP_DIR, | |
bowerJson: require('./bower.json'), | |
exclude: [ /jquery/ ], | |
fileTypes: { | |
html: { | |
replace: { | |
js: function(filePath) { | |
var minFilePath = filePath.replace('.js', '.min.js'); | |
if (fs.existsSync(process.cwd() + '/' + APP_DIR + minFilePath)) { | |
return '<script src="' + 'assets' + minFilePath + '?cache='+ CACHE_SLAYER +'"></script>'; | |
} else { | |
return '<script src="' + 'assets' + filePath + '"></script>'; | |
} | |
} | |
} | |
} | |
} | |
})) | |
.pipe(gulp.dest('./'+BUILD_DIR)) | |
.pipe(browserSync.stream()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment