0

我不断收到 UNCSS 的这个错误:'Warning: Destination (dist/css/main.css) not written because src files were empty. Use --force to contine. Aborted due to warnings.

我相信它可以正常运行任务并且设置正确。我可以将 grunt 用于其他事情。

在 gruntfile.js 中,我包括:grunt.loadNpmTasks('grunt-uncss');

  uncss: {
    dist: {
        files: {
          'dist/css/main2.css': ['../index.html']                                           
        }
    }
  }

我不确定出了什么问题,但我认为这是路径,但事实就是如此。我也在使用 SCSS,所以也许它需要一个原始的 css as SRC?我已经尝试在没有 Grunt 的情况下重新安装 PhantomJS 和原始 UNCSS,但我无处可去!有任何想法吗?

4

1 回答 1

0

我找到了解决方案。不一定是路径,而是路径是如何呈现的。

我正在使用

  files: {
      'dist/css/main2.css': ['../index.html']                                           
  }

我切换到

 files: [       
      { src: 'index.html', dest: 'dist/css/main.css' }
 ]

这里声明了src& dest

这个博客帮助了我deanhume.com。github/NPM 文档对我不起作用,但这个人对我有用。我希望这可以帮助别人!

于 2016-08-09T20:31:17.753 回答