简体   繁体   中英

grunt mini css html js: just copy to dest for some file

i'm use grunt task for minify static file like js,css,html.

but when i execute the task, i found some problem.

if in the css floder,include some gif for use. then those file con't build to dest direct.

if i don't want use copy plugin.

do u have any ideas for this case?

  uglify: {
        build: {
            expand: true,
            cwd: 'src/js',
            src: '**/*.js',
            dest: 'dist/js'
        }
    },
    cssmin: {
        minify: {
            expand: true,
            cwd: 'src/css/',
            src: ['*.css', '**/*.css'],//, '!*.min.css'
            dest: 'dist/css/'
        }
    }

cssmin and uglify won't copy your gif assets, you have to do this using grunt's copy task, with configuration like this

copy: {
  assets: {
    expand: true,
    cwd: 'src/css',
    dest: 'dist/css',
    src: '**/*.{gif,png,jpg}'
  },
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM