How to add multiple css files in grunt-css?

旧时模样 提交于 2019-12-11 12:16:50

问题


I am using grunt-uncss to remove redundant css from my project. For every HTML page referencing different css files, I am trying to create one css file for every html page. Here I am showing only two files but for real I am working with around 370 files. Here is my current code

 uncss: {
    dist: {
      files: 
        { 

'./newcss/75.css': ['./4dlife/src/app/views/com/twenty/todoPido.html'],

'./newcss/351.css': ['./4dlife/tools/experiments/index.html']
},
      options: {
        compress:true
      }
    }
  }
  });

However, the todoPido.html has no css files and hence my output is

Running "uncss:dist" (uncss) task ReferenceError: Can't find variable: require file:///home/pc009/code/4dlife_repo/4dlife/tools/experiments/index.html:35 Fatal error: UnCSS: no stylesheets found

However when I run this

  uncss: {
    dist: {
      files: 
        { 

'./newcss/351.css': ['./4dlife/tools/experiments/index.html']
},
      options: {
        compress:true
      }
    }
  }
  });

I am getting the proper output for the index.html.

Running "uncss:dist" (uncss) task ReferenceError: Can't find variable: require file:///home/pc009/code/4dlife_repo/4dlife/tools/experiments/index.html:35 File ./newcss/351.css created: 101.86 kB → 14.62 kB

Done, without errors.

What I can not understand is what am I doing wrong. It works fine when I give one file but fails when I add multiple files. What am I doing wrong? And also, how to remove the ReferenceError: Can't find variable: require?

来源:https://stackoverflow.com/questions/28565476/how-to-add-multiple-css-files-in-grunt-css

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