brunodd brunodd - 1 month ago 5x
Javascript Question

Grunt uglify - Update src after combining files

I am combining all my js files for production using

but after combining them and generating my final
file, how I can update the
script src

The index file should have only one
tag with
but instead its pointing to all sources that I used on develop mode.

uglify: {
options: {
mangle: false
all: {
files: [{
expand: true,
cwd: 'dev/assets/js',
src: ['*.js', '**/*.js'],
dest: 'prod/assets/js'
my_target: {
files: {
'prod/js/app.min.js' : ['prod/assets/js/**/*.js']


Take a look at the node package 'grunt-processhtml'. It will update the source links in your html file.

<!-- build:js app.min.js -->
<script src="my/lib/path/lib.js"></script>
<script src="my/deep/development/path/script.js"></script>
<!-- /build -->

<!-- changed to -->
<script src="app.min.js"></script>