Grunt uglify not finding files

后端 未结 2 1670
醉梦人生
醉梦人生 2021-01-20 21:01

I have the following directory structure:

--development 
  -js
    -pages

--js
  -pages

I\'m trying to take all files in development/js/pa

相关标签:
2条回答
  • 2021-01-20 21:37

    I wanted to answer with another option.

    Here is how I write my Uglify Grunt task incase you want to keep your options. It's setup to read as (dest : src), I also concat all my library files in task prior to Uglify.

    -

    uglify: {
            options: {
                // the banner is inserted at the top of the output
                banner: '/* \n Site: <%= pkg.name %> \n Version: <%= pkg.version %> \n Build Date: <%= grunt.template.today("mm-dd-yyyy") %> \n */\n \n'
            },
            site: {
                files: {
                    './_build/js/lib/lib.min.js': ['<%= concat.site.dest %>'],
                    './_build/js/app/app.min.js': ['./_build/js/app/app.js']
                }
            }
        },
    
    0 讨论(0)
  • 2021-01-20 21:43

    For anyone else looking the second option above almost worked but I needed to remove the options block and include expand in the files block:

    pages: {
                files: [{
                    expand: true,
                    cwd: 'development/js/page',
                    src: '*.js',
                    dest: 'js/page/',
                    ext : '.min.js',
                }]
                }
    
    0 讨论(0)
提交回复
热议问题