Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does grunt-usemin automatically update build:js blocks?

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.

like image 612
KevDog Avatar asked Feb 14 '23 08:02

KevDog


1 Answers

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.

like image 186
Matthew Bakaitis Avatar answered Mar 03 '23 06:03

Matthew Bakaitis