Images not found when doing a production build wit

2019-05-18 02:29发布

When I am trying to deploy my application in my prod the WAR do not have the images directory so i get my application deploy without any images.

What could be the problem?

3条回答
小情绪 Triste *
2楼-- · 2019-05-18 02:38

It looks like the cause of the problem is "gulp-imagemin", as a workaround remove this line:

.pipe(imagemin({optimizationLevel: 5, progressive: true, interlaced: true}))

from: gulpfile.js

查看更多
别忘想泡老子
3楼-- · 2019-05-18 02:41

If gulp-imagemin says it minified 0 images, it's often due to missing binaries needed in these node modules:

  • optipng
  • jpegtran
  • gifsicle

If you look eg. into node_modules/optipng-bin, you'll see that the optipng binary is missing (should be in a vendor subfolder).

They are not compiled during npm install, and it's completely silent :)

Installing the zlib1g-dev package fixed the issue on a fresh Debian 9 system.

I had to install build-base and zlib-dev https://github.com/imagemin/optipng-bin/issues/84

Generally speaking, you need several build tools on your system to build a JHipster prod package (make, g++ for scss, etc.).

查看更多
劫难
4楼-- · 2019-05-18 03:00

Your images must be in src/main/webapp/content/images to get minified and copied by gulp to target/www/content/images and then be copied at the root of you war in content/images by maven or gradle.

查看更多
登录 后发表回答