我目前正在尝试使用这从我的CSS文件中删除未使用的CSS。由于某些原因,我一直收到一个我无法解释的错误:
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
purifycss: {
options: {
},
target: {
src: ['templates/**/*.html'], // Observe all html files
css: ['static/css/main.css'], // Take all css files into consideration
dest: 'static/css/newcss.css' // Write to this path
}
}
});
grunt.registerTask('default', ['purifycss']);
};当我在命令行中运行grunt时,我得到:
>> TypeError: Cannot read property 'dependencies' of null
Warning: Task "default" not found. Used --force, continuing.
Done, but with warnings.有人知道为什么会这样吗?
发布于 2015-09-13 09:58:57
当您的package.json丢失并且正在使用load-grunt-tasks时,就会发生这种情况。运行npm init,遍历提示,然后检查生成的依赖项和devDependencies是否符合您的预期。
https://stackoverflow.com/questions/32510524
复制相似问题