Links for reference grunt-usemin

I have a very common problem, read many solutions (both stackoverflow and github) but still haven't found it to work for me.

What I am trying to solve:

  • angularjs so i am using angular generator (youma generator)
  • SASS preprocessor (doesn't actually work)
  • you need to use relative image links (../../images/yeoman.png), so they are correct before and after assembly (../images/yeoman.1er4b3.png)

I created a test project for this . To test usage:

grunt serve:build

      

Only solution for me can be found in this commit

cssmin: {
  options: {
    target: '.tmp/styles/any.css',
    relativeTo: '.tmp/styles/'
  }
}

      

But it has a problem: if compiled (after build) css file is in dist / styles / subfolder / (index.html contains <! - build: css ({. Tmp, app}) styles / views / views.css ->) , links will be broken.


This problem is related to the grunt-cotrib-cssminclean-the css .

Note: generator-angular creates a Gruntfile with the latest solution I saw in the help files, but that doesn't help in my case

usemin: {
  html: ['<%= yeoman.dist %>/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/styles/**/*.css'],
  options: {
    assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
  }
},

      

I would be glad if someone makes a test project as usual.

+3


source to share





All Articles