How to concat JS library files using gulp?

℡╲_俬逩灬. 提交于 2019-12-12 05:36:06

问题


Please check out my gist: https://gist.github.com/flyspaceage/9e88716294df93c8eaece51fe413f7a3

All of my files seem to concat properly except the JS libraries. Im using JS Socials, JS Scrollify, Headroom, JQuery 2.1.1, JS Slick. The files concat into one minified file, but the libraries no longer work in production. I am writing my first Gulpfile, any suggestions focused on Gulp appreciated.


回答1:


Place your vendor libraries in a different location. The reason why its not working is you are cleaning the dist directory, where the source files are present.

Move all the scripts present in this directory to a folder 'vendor'

libs: ['dist/scripts/libs/jquery.headroom.js', 'dist/scripts/libs/headroom.js', 'dist/scripts/libs/jssocials.js', 'dist/scripts/libs/slick.min.js', 'dist/scripts/libs/jquery.scrollify.js'],

then change the folder path to vendor

libs: ['vendor/scripts/libs/jquery.headroom.js', 'vendor/scripts/libs/headroom.js', etc..,,,],


来源:https://stackoverflow.com/questions/44833991/how-to-concat-js-library-files-using-gulp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!