0

I have my Bower vendor directory at resources/assets/vendor.

In my gulpfile, I've tried the following:

mix.scripts([
    "vendor/jquery/dist/jquery.min.js"
], "public/js");

When I run gulp in terminal, it doesn't seem to do anything. No errors though.

I also tried this:

mix.copy('vendor/jquery/dist/jquery.min.js', 'public/js/jquery.js');

To no avail.

What am I missing?

update & solution

Only sass,less and coffee scripts are by default looked for in resources/assets/[sass/coffee/less] while JS files are simply in resources/js which confused me. Beware.

Community
  • 1
  • 1
Petter Thowsen
  • 1,697
  • 1
  • 19
  • 24

1 Answers1

1

First of all, we don't know location of your jquery.min.js file. However the default location for scripts files is resources/js so to make it work, you should have your jquery.min.js file in resources/js/vendor/jquery/dist/jquery.min.js.

As 2nd argument you should pass your target filename with path, so it should be for example:

mix.scripts([
    "vendor/jquery/dist/jquery.min.js"
], "public/js/jquery.min.js");

assuming as I mentioned at the beginning you have this JS file in resources/js/vendor/jquery/dist/jquery.min.js location

If you don't, you should use 3rd parameter. So in this case, if your JS file is really in "vendor/jquery/dist/jquery.min.js" location, you could use:

mix.scripts([
    "jquery.min.js"
], "public/js/jquery.min.js", "vendor/jquery/dist");

to make it work.

EDIT

After explaining in comments, you should use then:

mix.scripts([
    "vendor/jquery/dist/jquery.min.js"
], "public/js/jquery.min.js", "resources/assets/js");
Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
  • I have my jquery.min.js located at `resources/js/vendor/jquery/dist/jquery.min.js` and nothing happens when I run `gulp` :\ – Petter Thowsen Feb 25 '15 at 18:34
  • @PetterThowsen So you should use the first code I showed, but as 2nd argument you need to pass filename and not just directory. – Marcin Nabiałek Feb 25 '15 at 18:35
  • @PetterThowsen I've just checked it and the file was generated without a problem. Do you have any gulp information for example `starting gulp` etc ? You should also make sure that you have the newest Laravel elixir installed. You should consider removing `node_modules` folder and running again `npm install` to get fresh copy of all modules. (you should of course backup this directory just in case) – Marcin Nabiałek Feb 25 '15 at 18:42
  • @PetterThowsen So you should probably doublt check if you have exact same code I have and you have this file in `resources/js/vendor/jquery/dist/jquery.min.js` path without spaces, in the same letter case as provided. – Marcin Nabiałek Feb 25 '15 at 18:56
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/71708/discussion-between-petter-thowsen-and-marcin-nabialek). – Petter Thowsen Feb 25 '15 at 19:13