Yeoman CSS image paths

我只是一个虾纸丫 提交于 2019-12-04 13:44:43

Update (24 Feb. 2014)

You can fix this by adding <%= yeoman.dist %>/images to the assetsDirs of the usemin task. See http://www.github.com/yeoman/yeoman/issues/824#issuecomment-32691465

Previous answer (4 Mar. 2013)

There is an issue named "usemin:css" doesn't generate correct image paths for relative urls on GitHub about this particular problem. Tak Tran has made a branch of Yeoman and implemented a fix.

Here is how I removed the current Yeoman installation and installed the branched-version of Tak Tran:

npm uninstall yeoman -g
git clone git://github.com/taktran/yeoman.git
cd yeoman/cli
npm install -g
npm link

Source: https://github.com/yeoman/yeoman/wiki/Additional-FAQ

With this fix, Yeoman wil rename relative image-paths in CSS and my question is answered. Thanks everyone for the help!

In GruntFile.js you need to adapt the usemin task, so that references will be processed:

// update references in HTML/CSS to revved files
    usemin: {
      html: ['**/*.html'],
      css: ['**/*.css']
    },

Check if you have this task config.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!