问题
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