0

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.

9
  • place your libraries in a different location. the reason why its not working is you are cleaning the dist directory, where the source files are. Commented Jun 29, 2017 at 20:10
  • so my libs directory should only contain JS that I wrote? Like my custom.js file? If i remove the JS libs then my dist directory will not have all files needed to deploy, is there a way to have it both ways? Commented Jun 29, 2017 at 20:39
  • you can create a different structure. scripts-> src (for files that you write) scripts->lib or scripts->vendor( for vendor specific). And update your gulp script respectively with the paths Commented Jun 29, 2017 at 20:40
  • Updated > gist.github.com/flyspaceage/9e88716294df93c8eaece51fe413f7a3.js Commented Jun 29, 2017 at 20:43
  • you can use pipe itself. Commented Jun 29, 2017 at 20:46

1 Answer 1

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..,,,],
Sign up to request clarification or add additional context in comments.

2 Comments

This allowed me to copy the files to another folder, however I need additional tasks defined to minify/uglify the scripts.
@FlySpaceAge: The comment deviates from the original requirement. Can you add this as a new question with the problems you are facing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.