4

I thought that when I moved .js files within a directory that grunt-usemin would update the .js files listed within the <!-- build:js({.tmp,app}) scripts/scripts.js --> blocks, but that doesn't seem to be the case.

I'm using the default Yeoman setup and haven't made any changes to the Gruntfile.js

I've tried grunt clean, but it seems to be only looking at the /dist folder.

Matthew Bakaitis
  • 11,600
  • 7
  • 43
  • 53
KevDog
  • 5,763
  • 9
  • 42
  • 73

1 Answers1

8

The grunt-usemin configuration only specifies where to find HTML files that should be scanned for <!-- build:... --> blocks. Usemin does not track the javascript (or css) files you want concatenated and uglified.

The .tmp folder is used for files that are in-flight to the distribution location.

If you are moving files around, you also need to edit the build:js blocks accordingly or look at the second link, below:

  1. can grunt automatically include all my js in index.html? - does not apply to usemin but is background for the next link

  2. How to include scripts automatically in a yeoman/grunt project? - a little extra work, but if you can define a pattern/glob for your scripts you can use this answer to generate the build.js block content before usemin kicks in and does its work.

  3. What is “{.tmp,app} ” in Yeoman generator?

  4. grunt-usemin docs - GitHub docs, not the greatest, but the more you use and configure the plugin the more it makes sense.

Community
  • 1
  • 1
Matthew Bakaitis
  • 11,600
  • 7
  • 43
  • 53
  • Excellent, thanks for your help! To be clear, I moved the files within a folder "app/scripts", where the files previously existed, creating a couple new subfolders in the process. I will definitely read those links, thanks again. – KevDog Apr 03 '14 at 18:32