yeoman / grunt-usemin

[UNMAINTAINED] Replaces references to non-optimized scripts or stylesheets into a set of HTML files (or any templates/views)
BSD 2-Clause "Simplified" License
1.22k stars 339 forks source link

Inline Styles not affected #501

Open iduuck opened 9 years ago

iduuck commented 9 years ago

Hi guys, I am currently working on a project with grunt-rev and grunt-usemin. Now I am in the build progress, but it seems to not affect the inline background-image styles I added to my html files. So everything is working with img tags and every external css background-image is affected, but no inline background-image style (Everything works in development – I'm using the Yeoman angular generator). Why?

This is the rev and usemin task:

rev: {
  dist: {
    files: {
      src: [
        '<%= yeoman.dist %>/scripts/{,*/}*.js',
        '<%= yeoman.dist %>/styles/{,*/}*.css',
        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
        '<%= yeoman.dist %>/styles/fonts/*'
      ]
    }
  }
},

// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
  html: '<%= yeoman.app %>/index.html',
  options: {
    dest: '<%= yeoman.dist %>',
    flow: {
      html: {
        steps: {
          js: ['concat', 'uglifyjs'],
          css: ['cssmin']
        },
        post: {}
      }
    }
  }
},

// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
  html: ['<%= yeoman.dist %>/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
  options: {
    assetsDirs: ['<%= yeoman.dist %>']
  }
},

Thanks in advance for any help!

stephanebachelier commented 9 years ago

@iDuuck you should have a problem with your configuration. Can you show me some urls for background images that you use as inline styles in your HTML files ?

ghost commented 9 years ago

@iDuuck @sindresorhus @stephanebachelier

stephanebachelier commented 9 years ago

@supergray we need more informations. I suppose you have the same issue as @iDuuck.

Is your generate up-to-date with grunt-usemin v3 ? Could you try with grunt-filerev instead of grunt-rev Are the HTML files real HTML files or templates (thus a js file) ?